Opened 8 years ago

Last modified 8 years ago

#5163 new defect

htmldoc needs --jpeg to create usable size pdfs

Reported by: anonymous Owned by: Diorgenes Felipe Grzesiuk
Priority: normal Component: TracWikiToPdfPlugin
Severity: normal Keywords:
Cc: felix@… Trac Release: 0.11


I have a trac Page with 4 images.

[root@s100 ~]# ls -l /srv/trac/psuc/attachments/wiki/BilderDoku/ -h
total 728K
-rw-r--r-- 1 apache apache 191K 2009-04-29 20:06 2009042....jpg
-rw-r--r-- 1 apache apache 175K 2009-04-29 20:12 20090429...f.jpg
-rw-r--r-- 1 apache apache 162K 2009-04-29 20:05 20090429...t.jpg
-rw-r--r-- 1 apache apache 179K 2009-04-29 20:04 verf...keit.jpg

Exporting this page as pdf results in a 17MB pdf.

I reproduced this on the commandline.

[root@s100 ~]# htmldoc test.html --jpeg=90 --format pdf14 --webpage -f jpeg.pdf
BYTES: 1217910
[root@s100 ~]# htmldoc test.html --format pdf14 --webpage -f raw.pdf
BYTES: 17382511
[root@s100 ~]# ll jpeg.pdf raw.pdf -h
-rw-r--r-- 1 root root 1.2M 2009-04-30 12:52 jpeg.pdf
-rw-r--r-- 1 root root  17M 2009-04-30 12:54 raw.pdf

I'd suggest to add the --jpeg option by default.

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by anonymous

I am happy with the following patch.

[root@s100 0.11]# svn diff
Index: wikitopdf/
--- wikitopdf/   (revision 5650)
+++ wikitopdf/   (working copy)
@@ -227,7 +227,7 @@
         os.write(hfile, page)

-        htmldoc_args = { 'webpage': '', 'format': 'pdf14', 'charset': codepage }
+        htmldoc_args = { 'webpage': '', 'format': 'pdf14', 'charset': codepage , 'jpeg': '85'}

         out = html_to_pdf(self.env, htmldoc_args, [hfilename], codepage)

comment:2 Changed 8 years ago by Nickolas Grigoriadis

Eish, This is not how my HTMLDoc works... If you don't specify --jpeg it includes the image files vanilla.

You can add:

jpeg =

to the wikitopdf-admin and wikitopdf-page sections in your trac.ini file. This will then add a --jpeg parameter.

or in your sample's case add:

jpeg = 90

Modify Ticket

as new The owner will remain Diorgenes Felipe Grzesiuk.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.