Hi, I am trying to convert html to pdf in linux redhat el 4 and tested a script called html2ps followed by ps2pdf. Unfortunately it seem that the html2ps ignores the <br> tag, nor does it support Arial font. So now I wonder if I can use open office to do it instead (read that there might be a possibility to do that somewhere). So now I got a few questions:
Is it possible to make a script open and save files via open office?
Can I do that even though I'm running in a shell (no graphical environment available)?
How would be the easiest way to achieve this?
I don't mind using perl, bash, or php (actually I prefer doing it in php but I'm far from sure that's possible).
The plan is that I will download a html-webpage a few times per day, then I want to take that webpage and convert to pdf in order to put it on an ftp-server.
Any suggestions or questions?
[Solved] converting from html to pdf in shell or php
[Solved] converting from html to pdf in shell or php
Last edited by Fnutt on Tue Jan 22, 2008 1:33 pm, edited 1 time in total.
Re: converting from html to pdf in shell or php
With OOo 2.3 you can get it working on Linux without a graphical environment: http://www.oooforum.org/forum/viewtopic.phtml?t=67044Fnutt wrote:Can I do that even though I'm running in a shell (no graphical environment available)?
Or you use xvfb (a virtual frame buffer) and let OOo run with that: http://www.oooforum.org/forum/viewtopic.phtml?t=11890
Does you HTML contain CSS? If so, keep in mind that OOo cannot handle CSS. Try to open your webpage with OOo Writer/Web to see how your HTML code looks inside OOo.Fnutt wrote:The plan is that I will download a html-webpage a few times per day, then I want to take that webpage and convert to pdf in order to put it on an ftp-server.
Any suggestions or questions?
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
Re: converting from html to pdf in shell or php
That seem like what I'm looking for, now I 'only' have to learn how to do macros (I think).hol.sten wrote:With OOo 2.3 you can get it working on Linux without a graphical environment: http://www.oooforum.org/forum/viewtopic.phtml?t=67044
Or you use xvfb (a virtual frame buffer) and let OOo run with that: http://www.oooforum.org/forum/viewtopic.phtml?t=11890
The html-files that I plan to convert are as far as I know clean html that open office seem to handle quite nicely.hol.sten wrote:Does you HTML contain CSS? If so, keep in mind that OOo cannot handle CSS. Try to open your webpage with OOo Writer/Web to see how your HTML code looks inside OOo.
Thank you so much for pointing me in the right direction. I'll work on this during the weekend and hope I can come up with something good.
Re: converting from html to pdf in shell or php
On the front page of http://www.OpenOffice.org — OOo as a service.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Re: converting from html to pdf in shell or php
Ok, thank you all for the great pointers, now I have gotten it to work using the guide, thank you so much =)