Opened 13 years ago

Last modified 4 years ago

#5163 new defect

htmldoc needs --jpeg to create usable size pdfs

Reported by: anonymous Owned by:
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 (3)

comment:1 Changed 13 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 13 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

comment:3 Changed 4 years ago by Ryan J Ollos

Owner: Diorgenes Felipe Grzesiuk deleted

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

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

Note: See TracTickets for help on using tickets.