PdfImages as PNG in Wiki
Insert vector graphics like PDFs or SVGs as PNG-images into a wikipage or ticket.
Requires convert from ImageMagick, convert may fail on specific files. Additionally, Ghostscript is required for convert on Windows, which is available here. The handling and the parameters are inspired by LaTeX includegraphics and the trac ImageMacro.
[[PdfImg(Book.pdf,width=400,page=100,caption="Page 100 from Book Example")]] [[PdfImg(source:testpro/drawing.svg@10,width=600,caption="SVG-image from repository in version 10")]] [[PdfImg(ticket:1:file.pdf)]]
Attention: PDF conversion with ImageMagick-convert:
- may fail on specific PDF s. This is not a problem of the plugin, this is a problem of convert. In this case you will get an error like " Can't display foo.pdf, ImageMagick->convert failed with errorcode=... , command=convert ... "
- if not restricted to certain pages, it can take very long; Example: Converting a PDF file of 400 pages by simply [[PdfImg(test.pdf)]] took several minutes! (see #9874, #9875)
Tested on this configurations:
|Ubuntu 11.04||0.11.7-4 (deb)||7:220.127.116.11-1ubuntu|
|Ubuntu 10.04.4 LTS||0.12.2 (easy_install)||7:18.104.22.168-1ubuntu|
|Win64 Server 2003 R2||0.12.2 (Bitnami)|| ImageMagick-6.7.5-6-Q16-windows-x64-dll.exe|
Possible trac links for resource: The Location of the file can be an attachment (wikipage, ticket, svn) or a local file (keyword "file:").
|= trac link (resource) =||= alternatives =||= comment =|
|wiki||JustPageName||Attachment in wikipage|
|file||need configuration file.prepath|
|= Parameter =||= Value =||= default =|
|pdffile||resource of PDF-file||required|
|page||Page to display||1||starting with 1|
|width||width in pixel||600||must be absolute value|
|caption||Caption under Image||none|
|label||anchor to link to|
|cache||build once or each time||True||time consumption or changing vectorgraphics|
- PdfImg macro runs with 100% cpu load
- calling PdfImg macro for PDF files of many pages takes very long
- support of pdf file ressource path for Apache location
- Resolution of image after convert is horrid
If you have any issues, create a new ticket.
Download the zipped source from here.
[[PdfImg(Book.pdf,width=400,page=100,caption="Page 100 from Book Example")]] [[PdfImg(sketch.svg,cache=False)]] [[PdfImg(OtherPage:foo.pdf)]] [[PdfImg(file:relpath/to/foo.pdf)]]
No configuration is needed except to use the Resource 'file:' the following configuration must set:
Assume your server is http://example.com and the webserver config mapped your local directory /absolute/entry/directory to the public directory entrydir then your configuration for the file:-resource looks like:
[pdfimg] file.prepath = /absolute/entry/directory file.preurl = http://example.com/entrydir
#9842 single quotes in convert command are optional under Linux, Windows dont like them..
changed files and folders to lowercase
naming according lowercase rule
- PdfImg_screenshot.png (63.1 kB) -
Screenshot with PDF and SVG, added by ursaw on 02/22/12 19:45:24.