View Full Version : HTML to PDF via mozilla


caritas
12-16-2008, 06:38 AM
About
-----

Convert HTML to PDF with mozilla rendering engine.

The best rendering application of HTML is web browser such as
FireFox(Mozilla), but full function web browser is too large for some
devices such as ebook reader. One of the solution is to pre-render
HTML on PC with web browser and send the resulting PDF to devices.


* Usage and configuration

Make sure you have Xulrunner correctly installed.

xulrunner --app html2pdf/application.ini [-pw <width>] [-ph <height>] \
file:///tmp/foo.html /tmp/foo.pdf

-pw and -ph is to used to specify paper width and height.

mb_html.tar.gz and mb.pdf is an example html and result.

bill_mchale
12-16-2008, 12:36 PM
Mmm, I haven't tried this particular method, though when I tried to save html files as PDFs using firefox on the Mac, I ended up having limited success. I might have had more luck if I rewrote the style sheets. That being said, I was trying to save the file as a PDF defined for a 5" screen.

I found PrinceXML handled the job very well once I defined the style sheet for my reader.

--
Bill

Elfwreck
12-16-2008, 07:41 PM
That being said, I was trying to save the file as a PDF defined for a 5" screen.
--
Bill
I made print settings for Acrobat to save for the Sony reader; 3.47x4.86" pages and 166dpi. It's what I use when converting from Word, but should work with HTML just fine.

For people with Acrobat Pro, it can either go in C:\Program Files\Adobe\Acrobat 7.0\Distillr\Settings or C:\Documents and Settings\All Users\Documents\Adobe PDF\Settings. People using other print drivers would have to look for where the options for those are saved.

Amalthia
12-16-2008, 08:25 PM
I made print settings for Acrobat to save for the Sony reader; 3.47x4.86" pages and 166dpi. It's what I use when converting from Word, but should work with HTML just fine.

For people with Acrobat Pro, it can either go in C:\Program Files\Adobe\Acrobat 7.0\Distillr\Settings or C:\Documents and Settings\All Users\Documents\Adobe PDF\Settings. People using other print drivers would have to look for where the options for those are saved.

I'm going to have to try this. :)

Elfwreck
12-17-2008, 03:07 AM
I'm going to have to try this. :)
Is very simple. It's settings that anyone could do--if they knew which of the dozen-odd buttons in the dialogue box to click on, and which tab to select, and when to click "Options," and which dropdowns are useful and which ones to skip because the later click will invalidate them...

Once you know the settings exist, it's a matter of seconds to set them, but it's nice to have a saved set for whatever kinds of PDF conversion you do most often.

Once this is installed, you can use Word, change your page size to 3.47x4.86 with whatever margin you like, and in the Adobe PDF menu, click "Change conversion settings."

Bookathon
12-26-2008, 05:20 PM
I read from How to create optimized sony pdf, and they mention 3.47x4.54 page size for sony 505 and your settings are little off, any particular reason?

llasram
12-26-2008, 05:56 PM
I read from How to create optimized sony pdf, and they mention 3.47x4.54 page size for sony 505 and your settings are little off, any particular reason?

The page size information in the Sony doc is rather off. Quite a while ago I produced Reader page-size tester PDFs (http://www.mobileread.com/forums/showpost.php?p=56277&postcount=33) which demonstrate the actual correct page size is exactly 88.184 x 113.854mm.

Bookathon
12-26-2008, 09:57 PM
I just happen to notice if you are in landscape mode the last line in bottom is dim as compared to other lines and it only happens in landscape mode, in portrate mode if text flows in that area, it would not exhibit any anomaly, changing text size does not not make a difference, still that area is murky, I happen to read some pdf in landscape mode, therefore noticed it

llasram
12-27-2008, 01:12 AM
I just happen to notice if you are in landscape mode the last line in bottom is dim as compared to other lines and it only happens in landscape mode, in portrate mode if text flows in that area, it would not exhibit any anomaly, changing text size does not not make a difference, still that area is murky, I happen to read some pdf in landscape mode, therefore noticed it

If I understand you correctly, I believe what you're seeing is the way is the way the Reader PDF renderer indicates the overlap between the two "halves" of the page. If the screen-width is scaled to fill the screen-height, that results in a scaling factor of (113.854mm / 88.184mm) = 1.291. Multiplying that times the page height yields a scaled height of 146.985mm, which is less than 2x the screen width (176.368mm). Sony fills in the extra space by having 14.691mm of each screen-page overlap content with the other screen-page showing the same PDF-page. It indicates this overlap with the fairly subtle graying effect.

Bookathon
12-30-2008, 01:55 PM
Thanks, it makes lot of sense.