It's better when it's simple

User Tools

Site Tools


dw2pdf plugin

For plugin developers, who want to export to PDF

If you're a plugin developer and want to make your syntax plugin compatible with the PDF export, here are a few tips:

  • provide a useful print.css and PDF export will probably work out of the box
  • if you want to use special stylings for PDF export provide a pdf.css
  • your HTML and CSS should be simple enough to be understood by mPDF (see documentation)

Custom HTML for PDF export

If you want to provide custom HTML for the PDF export you should check if the renderer is a renderer_plugin_dw2pdf when rendering xhtml.

function render($mode, $renderer, $data){
    if($mode == 'xhtml') {
           // this is the PDF export, render simple HTML here
           // this is normal XHTML for Browsers, be fancy here
       return true;
    return false;

Fetch images without HTTP request

By default, dw2pdf will fetch embedded images via HTTP. If you want to embed local image files without going through HTTP, you can give their location by writing an img tag using the dw2pdf:// pseudo protocol:

$R->doc .= '<img src="dw2pdf:///full/path/to/some/image.png">';


plugin/dw2pdf/exportsupport.txt · Last modified: 2017-11-19 23:55 by Klap-in