PDF exports with very pale grey text (not printable)

Since last update to XWiki Debian 16.5.0 the PDF export plugin works better with page formatting but unfortunately it is exporting text in very light grey which is not printable on laser printers

How do I change this setting to have black text instead?

I do no see any settings in the export feature to allow this, and to be honest changing the plugin settings or editing the “template” seems to be above my talent level at this moment :wink:

Hello! Could you provide a small screenshot of your issue?
I think we’d need to know a bit more about it to be able to help you.
E.g.

  • What the exact color of the text is
  • What kind of text is impacted (as far as I understood it was regular page content, but it wasn’t clear)

Have a good day!
Lucas C,

Hello Lucas, thanks for replying!

Attached are three screenshots.

No. 1 shows a snippet of the Xwiki page as it is displayed via Firefox.
No. 2 shows a screenshot of the produced PDF in “Xreader” (notice the grey text)
No. 3 shows a closeup of some text so you can see the color and the strange shadowy effect on the titles…



It seems that it happens because the PDF reuses the colors from your color theme. I could reproduce your bug using Darkly (white on black color theme).

While most colors from the wiki colortheme are kept, the background of the PDF export is always white.
What would make sense in my opinion is to have the background change color based on the colortheme background.

I’m not sure it’s something we always want to do. Some people might rely on this PDF export to print their pages, and having a background different from white would fail this.

Solution 1: Change the color theme on the page you want to export. Might not be the most convenient or cleanest but good enough for a quick fix :person_shrugging:

Solution 2: Check the PDFExport Sheet page and update the CSS to fit your use case. You probably want to update this style → xwiki-platform/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-ui/src/main/resources/XWiki/PDFExport/Sheet.xml at 5e10fb9d595c9cec79ae8a45faffdc56443d6424 · xwiki/xwiki-platform · GitHub

Solution 3: Open a ticket on our jira, propose a solution in a pull request on our github (and wait for someone else to handle it…) and get your wiki to the appropriate version. I checked and couldn’t find any ticket about your issue. It’s close but not the same as Loading...


Personally I think that it should be discussed with the community before proposing a fix if you go with Solution 3, I can see it messing with other people’s use cases, even if I don’t have a concrete example. Making sure that we get some feedback from other users would be good to push a change like this on xwiki standard.

Thank you for your report.
Don’t hesitate to let me know if you have trouble with the solutions I proposed.

Lucas C.

Wanted to give this a check and wow the PDF is almost blank!

Side-by-side comparison of the Home page, XWiki 15.10.11 with User browser as PDF generator (left Darkly, right Iceberg theme):

Do you mean we could have PDFs with a black background? That would be ink-wasting in printing…

Maybe we need separate themes for web and PDF? I just tried a PDF export with the Kitty theme and I’m unsure a PDF with violet text is appropriate :thinking:

Having the colortheme in the PDF can also be seen as a feature for some people :slight_smile: E.g. I have blue titles for some reason, it’s nice to have this theme color also in the documents I export. Second example: for some reason my organization standard is to have links in dark orange. That’s the way we have them on the wiki, and that’s how they are shown on the PDF exported.

If you press Ctrl+P to use your browser printing function, you should be able to get a print ready version of the page, which is slightly different from the PDF version and might work for your use case (and doesn’t get a black background).


The Kitty theme is not the most formal. Iceberg is the default and should work well :slight_smile:
:thinking: If we don’t decide on any other change, maybe we could display a warning if the main text color is too light when doing a PDF export?

Lucas C.

Yes for sure. However, in the not-too-long-past we have a different style for the PDF export (server side), with a specific CSS (pdf.css) than the view UI. It had the advantage of being less fragile and breaking less often. The downside was, ofc that you didn’t get a WYSIWYG export.

Maybe an idea would be to configure our PDF export with a special CSS (AFAIK it has this capability of configurability) and allow users in the admin UI to configure this and instead choose to use the color theme to be applied.

WDYT?

Thanks

Right now we still have a specific CSS in an SSX on the XWiki.PDFExport.Sheet page. It’s not a WYSIWYG export because it changes a few things, notably the background color.

Right now we have a template for the PDF Export.

  1. If we move the styles I mentionned above in the template, it could act as a way to configure this special CSS (and remove it if that’s what’s wanted by the admin). Technically it can already be removed but IMO it should be together with the template styles so that it’s straightforward to do.
  2. Maybe we also want to update the configuration UI to improve usability:


Right now the admin needs to understand that the box is not only a way to show the template in the list but also a link that they can right click to Open in a new tab and edit (left click doesn’t open it but just selects the item in the list). Adding an hint to highlight this use case could make it a bit easier to use.


Thank you for your idea!

Lucas C.

I think it’s very close to a WYSIWYG export. If you put aside the background color, the other changes that affect the content are barely noticeable. Most of the CSS from XWiki.PDFExport.Sheet is for PDF specific elements like cover page, table of contents, header, footer.

XWiki.PDFExport.Sheet is already supposed to contain only styles that are useful / common for any PDF template. I don’t see what other styles could be moved to the template besides the background color, but even for this I have some doubts.

The PDF Export configuration is not the only place where we use a page picker. In all those places it’s useful to open the selected / suggested pages in a new tab. I would improve the page picker instead of adding a hint everywhere it’s used.

Regarding the text / background color problem, I’m not sure if we can have a single PDF template that satisfies both needs:

  • be paper-print friendly (i.e. white background)
  • respect the current color theme 100% (i.e. the company / organization branding)

I think we need to provide two PDF templates (a paper print one and a WYSIWYG one) and let the user chose when exporting.

Thanks,
Marius

1 Like

+1 thx

The PDF is a change of medium, so I think it shouldn’t be expected to have a WYSIWYG experience.

Do you mean that standard holds for PDF prints too?
I’m just trying to figure out situations where the web and PDF themes should match 1:1

Yup, I imagined the standard would go across multiple file formats.

As a reply to Lucas for the propositions of solutions, I ended up changing the theme to a lighter one (I believe its called Garden or something like that) and while I prefer it visually it also exports PDF’s that are printable. I prefered changing the theme instead of modifying the program files and wait for a formal fix be deployed in a future update.

Now if I may provide my 2 cents on this topic, I think Xwiki should provide these options in the future:

  1. Export PDF in black & white only (simple monochrome text export, perfect for plenty of people looking to get a paper copy of a procedure, page, etc).

  2. Export PDF as a direct WYSIWYG identical to the theme being used. It will come with the pros and cons of it (i.e. dark backgrounds, problems printing, etc).

  3. Export PDF as a simplified WYSIWYG approach (i.e. export using theme settings but FORCE certain parameters such as text color and background color to ensure print-ability). This would probably cover Lucas’s use case of exporting using theme and have links in orange, etc… This option could also provide users with some configurable settings during the export process (example: convert text to black?, etc)

What do you guys think? I didn’t think this topic would be of much interest when I originally asked, but I am glad a constructive discussion ensued!

IMO the use cases are too varied to really warant the presence of a UI for everything. Having a few editable templates should be enough :slight_smile:


Created Loading... to keep track of the progress on this improvement (feel free to update the ticket with whatever relevant info I might have missed).

Thanks for opening this topic and discussing it with everyone :slight_smile:
Lucas C.