# Ticket #3493 (closed enhancement: fixed)

Opened 5 years ago

Reported by: Assigned to: nagrigoriadis@gmail.com grigi normal TracWikiToPdfPlugin normal andreasgebhardt@web.de 0.11

### Description

Since a significant number of images in our wiki is dynamicly generated images, such as emoticons and latex-math or similar, and there is no way to configure the current wikitopdf plugon to do it, I did a quick hack to wikitopdf.py to download the images to a temporary location and then use those.

Excuse the script oddness, I have never programmed in python before (I used wget to download the images)

Attached is the modified mikitopdf.py

## Change History

### 07/31/08 17:41:49 changed by nagrigoriadis@gmail.com

• type changed from defect to enhancement.

### 08/21/08 20:34:47 changed by diorgenes

• release changed from 0.10 to 0.11.

Hi Nickolas,

Please, I need a patch file with your code. Which trac version are you using?

Regards

Diorgenes F. Grzesiuk

### 08/21/08 21:50:31 changed by grigi

Hi Diorgenes

I'll re-do the code for that tomorrow, I was using Trac 0.11. I'll see if I can do the code a bit cleaner. (and optional)

I also have some other changes where I work around some HTMLDoc limitations, and if using HTMLDoc 1.9 (unstable) it even does code highlighting.

Sample input

### 08/22/08 13:59:14 changed by grigi

Sample Output - HTMLDoc 1.9

### 08/22/08 14:05:01 changed by grigi

Hi Diorgenes

[wikitopdf] tmp_dir = /tmp/wikitopdf trac_uri = http://trac.blah.is.co.za css_file = /var/lib/trac/IS/conf/htmldoc.css

both trac_uri and tmp_dir has to be defined for the dynamic image downloading to work. (Otherwise it uses the existing method, to not break upgrades) the css_file points to a css file (included in patch) for HTMLDoc 1.9, so that code highlighting can work.

The patch also adds tables around div frames, so that the output looks closer to the wiki pages.

I know that there is a lot of changes, but you can take your time evaluating them.

Thanks, Nickolas

### (follow-up: ↓ 6 ) 08/22/08 14:05:58 changed by grigi

[wikitopdf]
tmp_dir = /tmp/wikitopdf
trac_uri = http://trac.blah.is.co.za
css_file = /var/lib/trac/IS/conf/htmldoc.css


### (in reply to: ↑ 5 ) 08/25/08 21:00:47 changed by diorgenes

• status changed from new to assigned.

{{{ [wikitopdf] tmp_dir = /tmp/wikitopdf trac_uri = http://trac.blah.is.co.za css_file = /var/lib/trac/IS/conf/htmldoc.css }}}

Hi

I need more time for study your contribution. Just for now thank you.

Regards

Diorgenes F. Grzesiuk

### (in reply to: ↑ description ) 09/20/08 11:12:29 changed by andreasgebhardt@web.de

• cc set to andreasgebhardt@web.de.
• type changed from enhancement to defect.

Since a significant number of images in our wiki is dynamicly generated images, such as emoticons and latex-math or similar, and there is no way to configure the current wikitopdf plugon to do it, I did a quick hack to wikitopdf.py to download the images to a temporary location and then use those.

Hi everyone,

i had similar problems. In wikitopdf.py (45-50) the base_dir is set as prefix for image source.

45 	    imgpos = page.find('<img')
46
47 	    while imgpos != -1:


But the image source is like https://localhost:8443/trac/sandbox/attachment/wiki/WikiStart/image.jpg. After adding base_dir, which points to the trac project, i had base_dirhttps://localhost:8443/trac/sandbox/attachment/wiki/WikiStart/071small.jpg which isn't the right image source. So i substitute the base trac uri by base_dir

abs_ref = (req or env).abs_href.base
href = (req or env).href.base


As result now i get !base_dir/attachment/wiki/WikiStart/image.jpg.

[wikitopdf]
graphviz_dir =
tracmath_dir =


These are the direcories where the both plugins save there images. A patch file is added as attachment.

Best regards,
Andreas Gebhardt

### 09/20/08 11:14:00 changed by andreasgebhardt@web.de

support for TracMathPlugin and Graphviz Plugin, base_dir substituion

### 10/21/08 15:36:03 changed by grigi

Update of patch for WikiToPdf? 2.2.2

### 10/21/08 15:38:34 changed by grigi

diorgenes, Do you need me to split the patch into several small parts? I would like to get as much of this into the mainline version.

### 01/14/09 04:56:29 changed by iamer@open-craft.com

Patch to fix downloading images that have params in their name like "?width=" for example like the ones generated by google charts plugin.

### 01/28/09 10:22:39 changed by grigi

Just a note: htmldoc version htmldoc-1.9.x-r1586 has broken headers/footers, version htmldoc-1.9.x-r1563 works fine.

You only need the unstable 1.9 version if you want syntax highlighting and/or css support.

### 04/23/09 10:33:28 changed by grigi

• status changed from assigned to new.
• owner changed from diorgenes to grigi.
• type changed from defect to enhancement.

This ticket's patches has been added to the svn repos. Leaving ticket open until updating documentation.

### 05/07/09 13:59:45 changed by grigi

• status changed from new to closed.
• resolution set to fixed.

Change Properties