Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5252

Corrupted fonts with rendering inside SwingWorker

    XMLWordPrintableJSON

Details

    Description

      Page rendering is a time-consuming operation, so I try to perform it in separate thread (via Swing Worker). It's mostly working, but sometimes I face error messages in my log. Then, in some cases fonts on rendered page might become corrupted (just like on attached picture, where word "istream" is rendered like "istrea" with wide "a"). I don't remember such issues using single-thread, but that's not suitable for me (application UI freezes if I perform rendering in the same thread).
      Here's a link to my PDF: https://disk.yandex.ru/i/bZMPleH_GosWug

      авг 07, 2021 12:16:56 PM org.apache.pdfbox.filter.FlateFilter decompressавг 07, 2021 12:16:56 PM org.apache.pdfbox.filter.FlateFilter decompressWARNING: FlateFilter: premature end of stream due to a DataFormatExceptionавг 07, 2021 12:16:56 PM org.apache.pdfbox.pdmodel.font.PDCIDFontType0 <init>SEVERE: Can't read the embedded CFF font Fd2121547java.io.IOException: illegal offset value 132698 in CFF font at org.apache.fontbox.cff.CFFParser.readIndexDataOffsets(CFFParser.java:192) at org.apache.fontbox.cff.CFFParser.readIndexData(CFFParser.java:201) at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:486) at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:122) at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:75) at org.apache.pdfbox.pdmodel.font.PDCIDFontType0.<init>(PDCIDFontType0.java:100) at org.apache.pdfbox.pdmodel.font.PDFontFactory.createDescendantFont(PDFontFactory.java:135) at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:196) at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:97) at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146) at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:66) at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:933) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:514) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:492) at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155) at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:277) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:347) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:268) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:228) at MainWindow$pageLoader.doInBackground(MainWindow.java:286) at MainWindow$pageLoader.doInBackground(MainWindow.java:1) at javax.swing.SwingWorker$1.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javax.swing.SwingWorker.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
      авг 07, 2021 12:16:57 PM org.apache.pdfbox.pdmodel.font.PDCIDFontType0 <init>WARNING: Using fallback LiberationSans for CID-keyed font Fd2121547

      Attachments

        1. MainWindow.java
          10 kB
          Maxim
        2. Снимок.PNG
          163 kB
          Maxim

        Activity

          People

            Unassigned Unassigned
            MVoloshin Maxim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: