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

Error Opening PDF in Adobe Reader - The font 'HoneyScript-Light' contains bad /Widths.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.7.0
    • Fix Version/s: None
    • Component/s: FontBox, JempBox
    • Labels:
      None
    • Environment:
      Java, Linux , Mac OS

      Description

      The pdf created using PDFBOX 1.7.0 file contains errors when opening in Adobe Reader with error msg: "The font 'HoneyScript-Light' contains bad /Widths."

      Created a new pdf file written with the below piece of code and tried to open it in Adobe Reader, while opening getting an error message- "The font 'HoneyScript-Light' contains bad /Widths." . This error is also occurring even while writing in existing pdf document.
      I am using Adobe Reader Version 11.0.1. , even tried in 10.1.6. the same issue persist

      PDDocument pdDocument = new PDDocument();
      pdDocument.addPage(new PDPage());
      BufferedImage bi = new BufferedImage(10, 10, 10);
      Points point = new Points(300, 500);
      @SuppressWarnings("unchecked")
      List<PDPage> list = pdDocument.getDocumentCatalog().getAllPages();
      PDPage pdPage = list.get(list.size() - 1);
      String fontPathName = "HoneyScript-Light.ttf";
      PDFont fonta = PDTrueTypeFont.loadTTF(pdDocument,
      Sample.class.getClassLoader()
      .getResource(fontPathName).openStream() );
      PDJpeg ximage = new PDJpeg(pdDocument, bi);
      PDPageContentStream contentStream = new PDPageContentStream(pdDocument,
      pdPage, true, true);
      contentStream.beginText();
      contentStream.setFont(fonta,18);
      contentStream.moveTextPositionByAmount(point.getX(), point.getY() - 10 );
      contentStream.setNonStrokingColor(Color.black);
      contentStream.drawString("Name: ");
      contentStream.endText();
      contentStream.close();
      pdDocument.save("test/Test.pdf");
      pdDocument.close();

      The same has been tried with fonts such as MyriadSetText.ttf, Miama.ttf, Myriad.ttf.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lehmi Andreas Lehmkühler
                Reporter:
                harippriya Harippriya Parameswaran
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: