Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: LANMonkey on September 15, 2010, 11:28:01 PM

Title: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 15, 2010, 11:28:01 PM
I need to be able to convert  the HTML files I am serving to PDF files.  Is there anything in SME or available to it to convert HTML to PDF files?  I've seen the perl module, but that does not support CSS.

I did a little searching here at the forum and found this clue:

http://forums.contribs.org/index.php/topic,22505.msg89350.html#msg89350

If this is my solution, could anyone summerize how I might apply it?  I am brand new to creating PDF files, but I think I understand that it is somehow related to printing.

I looked through the contribs and couldn't see anything that looked like what I need.

Any and all tips or clues would be appreciated.

Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: Stefano on September 15, 2010, 11:38:15 PM
hi

take a look here: http://mpdf.bpm1.com/
HTH
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 16, 2010, 12:00:00 AM
Looks good.  Give me 24 hours or so to check it out.

Anyone else?
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: axessit on September 16, 2010, 04:44:12 AM
Not entirely sure what you're trying to do, are you wanting users to 'print' a document (that was generated by some webpage app) and get a pdf, in which case the CUPS print to pdf is definitely the way to go, or are you wanting a webpage app to generate a PDF ?

It might be a bit off the tangent, but Hylafax generates an html email with a PDF attachment, but more importantly, can generate a PDF from an email that is html, if you dig down deep into the Hylafax routines.....
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 16, 2010, 06:24:52 AM
I am currently posting PHP pages generated by MySQL to the internet that are reports and I would like to be able to offer them in PDF form.  And there are volumes of other static HTML pages and I need a command line tool to convert these, something I can apply through a script and process these pages automatically.  I would also like to collate them into sets of pages.

I saw some discussion of Hylafax and would prefer a more dedicated technology.  I was hoping for a perl module, but the only ones I saw did not support CSS.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: axessit on September 16, 2010, 06:50:09 AM
OK, not tried anything like this before, but just addding an idea you might want to follow up on....

I guess it depends on whether you are printing from internal network or external, that may be an issue, but ghostscript is generally used, so you could perhaps do some research around that.

If you are thinking along the lines of the the cups pdf printer, it would, of course, need to see a print job (which could be from a lp command line - ie generated from a perl script) but from the internal network, and it can be sent to a folder, which can be scanned by your web app.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: Jáder on September 16, 2010, 12:08:49 PM
hi

take a look here: http://mpdf.bpm1.com/
HTH
And search Google for "PDF php"
Ifound this one too: http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 16, 2010, 06:46:30 PM
OK, not tried anything like this before, but just addding an idea you might want to follow up on....

I guess it depends on whether you are printing from internal network or external, that may be an issue, but ghostscript is generally used, so you could perhaps do some research around that.

If you are thinking along the lines of the the cups pdf printer, it would, of course, need to see a print job (which could be from a lp command line - ie generated from a perl script) but from the internal network, and it can be sent to a folder, which can be scanned by your web app.

This sounds more like what I am looking for.  And it sounds like maybe it is more of a Linux question rather than an SME question.

It sounds like everything is already in place to pring from SME to a PDF file using lp.  But I've tried fooling around with lp and have had a lot of difficulty.  Would anyone know of any documentation to walk me through the process of printing to a PDF file in Linux?  Would this be any different in SME?  I see very little in the SME documentation on printing.  I do see a queue manager in the contribs,

http://wiki.contribs.org/LPRng_print_queue_monitor

How would I print to a PDF file using lp?
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 16, 2010, 07:06:56 PM
LANMonkey

Did you read this Contrib article
http://wiki.contribs.org/Cups

Please search using google
http://www.faqs.org/docs/Linux-HOWTO/Printing-Usage-HOWTO.html
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 16, 2010, 07:11:54 PM
Yes, thank you.  I searched the forum for "cups-pdf" after finding the subject under google.  There I found the link.

But I was unable to find the link in the usual list of HowTo's, FAQ's and the rest.   Could you show me a page in the SME references that has that link?  That is where I looked first.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 16, 2010, 07:26:08 PM
http://wiki.contribs.org/Cups

At the above link, there is a note saying that the require repository is not functioning and offers a source for the RPM.  But, there is no documentation there or at the referencing links as to how to apply the RPM instead of the repository.  How do you do that?  Is there a simple substitution?

Also I need to know how to actually print to a PDF file using this installation and none of the links provided do that either.

Does anyone have this information?
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 16, 2010, 07:59:08 PM
LANMonkey

Quote
Could you show me a page in the SME references that has that link?  That is where I looked first.

Please read the last line of my signature which says
Contribs can be found at http://wiki.contribs.org/Category:Contrib

You can also click on the Wiki link at top of forums, & then on right hand side is a link to Contribs.
You need to read all the contribs.org pages more carefully, the Contribs page has been there for years !
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 16, 2010, 08:31:13 PM
LANMonkey

Quote
there is no documentation there or at the referencing links as to how to apply the RPM instead of the repository.  How do you do that?  Is there a simple substitution?

You need to read all the links referred to. In the CUPS article in the note re the repo not working, it refers to a forum thread re problems with the repo. In that forum thread it also refers to another forum thread on the same topic. In BOTH threads it advises how to install rpms using yum ie
download all the rpms to an empty folder and then cd to that folder and do
yum localinstall *.rpm
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 16, 2010, 08:50:42 PM
LANMonkey

Quote
I need to know how to actually print to a PDF file using this installation and none of the links provided do that either.

You have a non standard requirement, so you have to be proactive in your
approach. Read again carefully all the links you have been given.
Also do a google search on
print to PDF file from Linux command prompt
and make sure you carefully and slowly read the answers. You are skipping over the information.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 16, 2010, 09:01:12 PM
LANMonkey

Quote
http://forums.contribs.org/index.php/topic,22505.msg89350.html#msg89350
could anyone summerize how I might apply it?

Referring to your original post, which essentially asks how to configure & use CUPS, install that using the yum localinstall command and follow the current CUPS wiki article carefully. See how you go & whether that fulfills your requirements.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: Stefano on September 16, 2010, 09:03:02 PM
I need to be able to convert  the HTML files I am serving to PDF files

please explain the problem.. do you have some php pages? do you need to obtain pdf from static html pages?
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: LANMonkey on September 17, 2010, 12:48:46 AM
Yes, Stefano, I need to obtain PDF files from static HTML pages.  And I need to do it from a script so that I may bulk process batches of HTML files from the command line.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: janet on September 17, 2010, 04:06:44 AM
LANMonkey

Make note of this section and the link page it refers to

http://wiki.contribs.org/Cups#Printing_from_Linux_through_a_local_LPR_spooler_or_standalone_lpd_client
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: chris burnat on September 19, 2010, 02:20:52 AM
Moved to General Discussion.
Title: Installation problems
Post by: LANMonkey on September 20, 2010, 11:19:51 PM
OK, I followed the instructions at this link:

http://forums.contribs.org/index.php/topic,40484.html

I used these instructions,

Code: [Select]
mkdir -p cups_rpms
cd cups_rpms/
wget ftp://smeserver.hkisl.net/smeserver/contribs/rvandenaker/testing/smeserver-cups/repositories/7.0/RPMS/i386/*
wget ftp://smeserver.hkisl.net/smeserver/contribs/rvandenaker/testing/smeserver-cups/repositories/7.0/RPMS/noarch/*
yum localinstall *.rpm

Although, the RPMs did not all install to the cups_rpms directory.  They installed to another directory which wget showed in the output.  I moved all the files together back into the single cups_rpms and did the "yum localintall *.rpm".  I also had some difficultry tracking down a live download link.

But, it would not install.  I am getting missing dependency errors.  If anyone would like to see what they were, tell me how to collect the information and I will post it.  The above instructions were applied after removing the LPRng software as instructed at the original link (http://wiki.contribs.org/Cups) that links to the correction applying the localinstall.

Does anyone have any ideas to try next?
Title: Re: Installation problems
Post by: janet on September 21, 2010, 02:06:10 AM
LANMonkey

To check you have downloaded ALL the rpms

cd /cups_rpms
then show the output of
ls -al

To see if each rpm is installed one by one do
rpm -q packagename
eg
rpm -q cups

You can add all the packagenames in the rvandenaker contrib folder on one line
see
http://mirror.contribs.org/contribs/rvandenaker/testing/smeserver-cups/repositories/7.0/RPMS/i386
and
http://mirror.contribs.org/contribs/rvandenaker/testing/smeserver-cups/repositories/7.0/RPMS/noarch
(these will resolve to the fastest available mirror download site)

rpm -q cups ghostscript gimp-print-cups-common pkgname pkgname pkgname etc etc etc
and so on adding all the other package names


As it says in the Wiki article at http://wiki.contribs.org/Cups
manually download all the rpms using a web browser

Then copy them to your sme server, checking that they have all been downloaded
then issue the command
yum localinstall *.rpm


Furthermore you really need to provide the error messages you see when doing the yum install so that we can see what dependency errors you have.
Be realistic, most of us are not mind readers (although some of us may have that talent).

If you are using a Putty ssh window, then right click on the icon in the top left corner and select copy all to clipboard (or similar), then paste that into a message here, and remove any security info from the history.

I just manually download all 16 rpms to my user home folder
then cd'd (changed to that folder) and issued
ls -al
to check all rpms were there
then did
yum localinstall *

which seemed to work except for the one dependency error due to not uninstalling the e-smith-LPRng package first
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: dgs on September 22, 2010, 01:11:24 AM
Not sure if this is what the OP is after but have a look at http://www.tufat.com/s_html2ps_html2pdf.htm (http://www.tufat.com/s_html2ps_html2pdf.htm) .

I haven't tried it but I had some success with a PDF form generator http://www.tufat.com/s_pdf_reports_mysql.htm (http://www.tufat.com/s_pdf_reports_mysql.htm) from the same author.
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: alten on September 22, 2010, 02:37:02 AM
Another avenue you could use (after solving the CUPS printing thing) is to print to GIF (or experiment to find a better format) and pipe the output to GRAPHICSMAGICK (http://www.graphicsmagick.org/) which seems to be very efficient. 
Title: Re: Is there anything in SME to convert HTML to PDF files? CSS support required.
Post by: Abigail111 on September 17, 2013, 05:03:03 AM
Hello
 Although i have never try to convert HTML to pdf files in SME.But i often convert image formats to pdf with a pdf convertor.
Here is my method to convert files:
 public void ConvertPdftoHtml (http://www.rasteredge.com/how-to/csharp-imaging/pdf-convert-html/)(string PDFInputFile, int PDFPageNumber, string HTMLOutputFile);
YOu can have a look.Hope to help you.