You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2019/01/30 05:03:00 UTC

[jira] [Commented] (PDFBOX-4448) "Weasyprint" PDF's causing large memory spike

    [ https://issues.apache.org/jira/browse/PDFBOX-4448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16755679#comment-16755679 ] 

Tilman Hausherr commented on PDFBOX-4448:
-----------------------------------------

This is a known java problem:[https://blog.idrsolutions.com/2012/05/avoid-transparency-when-printing-in-java/]

These weasy folks are painting the whole page with an empty pattern. WTF?
{code:java}
1 0 0 -1 0 841 cm
q
  q
    /Pattern cs
    /p6 scn
    /a0 gs
    0 0 595 841 re
    f
  Q
  0 0 0 rg
  /a0 gs
  BT
    24 0 0 -24 62.25 94.86328 Tm
    /f-0-0 1 Tf
    (test) Tj
  ET
Q
{code}
That pattern has a form XObject which has another form XObject which is just "q
Q" which does nothing.

> "Weasyprint" PDF's causing large memory spike
> ---------------------------------------------
>
>                 Key: PDFBOX-4448
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4448
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.13
>         Environment: Windows 10 (x64)
>            Reporter: Brett
>            Priority: Major
>              Labels: print, printing
>         Attachments: test.pdf
>
>
> PDF's created with "[weasyprint|https://weasyprint.org/samples/]" appear to cause a massive spike in memory usage when printing. This can be seen in their "invoice sample" provided on their page (causes a ~2.5gb average spike for a 47kb file) or the attached test pdf (causes a ~1.8gb average spike for a 6kb file).
> Trying to source the cause in the java print libraries seems to indicate it's a problem with "nonsolid colors" being used in the drawing of the page (which we are passing off to a PDFPrintable). On my windows machine, normally a ({{sun}}) {{WPrinterJob}} gets created for printing, but for some reason these pdf's end up using a Paint flagged as incompatible which [fails the job creation|https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/windows/classes/sun/awt/windows/WPrinterJob.java#L793].
> Trying to print with just pdfbox from the command line gives similar results in memory usage spiking to what we are seeing in our application: {{java -jar pdfbox-app-2.0.13.jar PrintPDF -printerName PDFCreator test.pdf}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org