Use custom PDFTemplate by default

Hello,

I customized PDF export with this way:
http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HOverridethexhtml2fo.xslrules
I attached xhtml2fo.xsl and use$xwiki.getDocument(‘MyApp.PDFTemplate’).getAttachment(‘xhtml2fo-myapp.xsl’).contentAsString like Anca said: https://jira.xwiki.org/browse/XWIKI-5918?focusedCommentId=70356&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-70356

PDF export use my PDFTemplate if I use URL: http://yourserver/xwiki/bin/export/XWiki/PDFTemplate?format=pdf&pdftemplate=XWiki.PDFTemplate but I want that all my PDF export use my PDFTemplate.

For this I edited ./templates/pdf.vm file :

#template("xwikivars.vm")
#if ($request.pdftemplate)
  #set ($pdfdoc = $xwiki.getDocument($request.pdftemplate))
#else
  ## set($pdfdoc = $tdoc)
  #set ($pdfdoc = $xwiki.getDocument("XWiki.PDFTemplate"))
#end

but it doesn’t work (on xwiki 8.4.4 version)

Any ideas?

(BTW it will be great if we could use xhtml2fo.xsl in filesytem like pdf.css file)

Thxs
./templates/pdf.vm
Pascal B

Just answering on this point: you can put a modified version of this file in your WEB-INF/classes directory and XWiki should pick your version instead of the default one from the oldcore JAR. Note that you can also override it in a wiki page as an xhtmlxsl xproperty of class XWiki.PDFClass.

yes I used this way but it doesn’t work with export menu (with url it’s working well).
I will test a file under WEB-INF/classes directory (and soon edit your PDF documentation)

yes it’s working well, ty :slight_smile: