Modify ↓
Opened 17 years ago
Last modified 7 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 |
Description
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 PAGES: 4 BYTES: 1217910 [root@s100 ~]# htmldoc test.html --format pdf14 --webpage -f raw.pdf PAGES: 4 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 17 years ago by
comment:2 Changed 16 years ago by
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 7 years ago by
| Owner: | Diorgenes Felipe Grzesiuk deleted |
|---|
Note: See
TracTickets for help on using
tickets.



I am happy with the following patch.
[root@s100 0.11]# svn diff Index: wikitopdf/wikitopdf.py =================================================================== --- wikitopdf/wikitopdf.py (revision 5650) +++ wikitopdf/wikitopdf.py (working copy) @@ -227,7 +227,7 @@ os.write(hfile, page) os.close(hfile) - htmldoc_args = { 'webpage': '', 'format': 'pdf14', 'charset': codepage } + htmldoc_args = { 'webpage': '', 'format': 'pdf14', 'charset': codepage , 'jpeg': '85'} htmldoc_args.update(dict(self.env.config.options('wikitopdf-page'))) out = html_to_pdf(self.env, htmldoc_args, [hfilename], codepage)