Debuging style in PDF export in xwiki 8.4.4

Hi,

I read the PDF export guide on http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HCustomizingthePDFexportLook26Feel

and I looking for a way to simply styling the export with pdf.css or PDFClass.
My goal is to debug/test some CSS properties like I do wih firebug (changing a property and see the result) without export the PDF to see the result.

I have another question about PDF export. I have a space (a velocity application) and I want some custom PDF export for this space only. I read I could use the pdftemplate parameter in the URL but I don’t want add a button in my application to export. I want that the user use the xwiki standard export menu.
Do you know a way to do these?

Thxs

Pascal B

I think I found a way to do this :slight_smile:

  • copy/paste templates ( pdfhtmlheader.vm, pdfheader.vm, pdffooter.vm, pdftoc.vm, pdfcover.vm) between html tags
  • use a SSX object
  • and firebug

I don’t think we have a solution for this ATM, except doing the following:

  • Define a custom skin for your space
  • In that custom skin, override pdf.vm

in your custom pdf.vm, force the pdftemplate to use by replacing the following:

#if ($request.pdftemplate)
  #set ($pdfdoc = $xwiki.getDocument($request.pdftemplate))
#else
  #set($pdfdoc = $tdoc)
#end

ty good idea.

Last question about debuging pdf export.
How can I have intermediate state of file in the 4 step in the diagram of PDF process:: http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HCustomizingthePDFexportLook26Feel ?
At least the “initial XHTML” file?
I want to use a pdf.css file and to use it I need XHTML file to watch div id/class.

I found this peeter’s way with debug logging: http://xwiki.475771.n2.nabble.com/styling-PDF-and-ODT-export-td7116069.html#a7132269

Selected post Dec 28, 2011; 10:55am Re: styling PDF and ODT export
Answering my own question about inspecting contents of created XHTML file (to be able to style it) - turn on logging http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Logging and set com.xpn.xwiki level to debug, look for message with “Final XHTML for export” (or after applyCSS - “HTML with CSS applied”).
cheers,
-peeter

He’s right :), I can retrieve xhtml code in my logs/catalina.out after

  • DEBUG c.x.x.p.i.PdfExportImpl - Cleaned XHTML: <?xml version="1.0" encoding=xxxxx
  • DEBUG c.x.x.p.i.PdfExportImpl - HTML with CSS applied: : <?xml version="1.0" encoding=xxxxxx

Probably I could display it in xwiki page or simpler with a sed to a static html page :slight_smile:

It seem that using a pdf.css, to styling PDF export, doesn’t work with multi class element…

I create a pdf.css to customize my PDF export:
I’m debuging a page export (my page containing a TOC):

  • cleaned XHTML containing:
<div id="xwikicontent">
<div class="box floatinginfobox">
  • Applying the following CSS:
div.box.floatinginfobox {
  color: "pink";
  display: "none";
}
  • but the result: HTML with CSS applied:
<div id="xwikicontent" style="display: block; ">
<div class="box floatinginfobox" style="display: block; ">

Anyway when I use an unique Class to target an element it’s working well
ie

.floatinginfobox {
  color: "blue";
  display: "none";
}

<div id="xwikicontent" style="display: block; ">
<div class="box floatinginfobox" style="display: none; color: blue; ">

Be careful that I’ve very recently fixed issues with a custom pdf.css by upgrading to CSS4J 0.24+

See http://jira.xwiki.org/browse/XWIKI-14279 and the related JIRA issues.

I would be interested to know if it works with a XWiki 9.4RC1 version (or a snapshot version of master).

Can this topic be closed (the topic was about debugging styles in PDF export)? Thanks

Yes (I can choose only one answer but I asked multiple questions).
Anyway I will check on XWiki 9.4RC1 the multi class issue.