[
https://issues.apache.org/jira/browse/PDFBOX-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14969796#comment-14969796
]
Petr Slaby commented on PDFBOX-3046:
------------------------------------
I have seen this effect in our software using PDFBox a few years ago and I
believe this PDF has the same problem. The answer lies in the implementation of
sun.print.RasterPrintJob. It lets you render the page first into a dummy
PeekGraphics which just searches for the types of graphical objects you want to
use. Next, for each transparent bitmap it finds, it creates a BufferedImage
having the size and position of that bitmap and calls the Printable.print()
method again passing the BufferedImage g2d surface to it, to "flatten" all
layers into the bitmap. Put a breakpoint into PDFPrintable.print() and, with
this specific PDF, you will see that you arrive into it million times, always
printing the same page 1 again and again. The one I was analyzing when I have
seen the problem for the first time, was using a bitmap font, each character
being a single small transparent bitmap. I believe the one attached here will
be the same.
The only remedy I found is to render the whole page into a bitmap first and
only then pass it to the java printing API. Since printing huge bitmaps is not
desired in general, I count the transparent bitmaps in the page to be printed
first and resort to the full page bitmap printing only if there are "many".
> Specific PDF prints really (REALLY) slow
> ----------------------------------------
>
> Key: PDFBOX-3046
> URL: https://issues.apache.org/jira/browse/PDFBOX-3046
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.0
> Environment: Windows 10
> Reporter: Teon Metselaar
> Attachments: mspubcol.pdf, mspubcol.prn
>
>
> On Windows 10 I have printed a test page using the MS Publisher Color Printer
> (which outputs a Postscript-file) and converted that file to PDF using
> GhostScript ps2pdf.
> The resulting single-page PDF file is printed really, really slow (180-190
> seconds) while other documents (even generated using ps2pdf) print a lot
> faster (some seconds).
> I can't figure out why this is. I guess it has someting to do with the used
> font, but other PDF printing libraries (jPedal, jPDFPrint) are able print the
> same documents in a couple of seconds.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]