Harippriya Parameswaran created PDFBOX-1567:
-----------------------------------------------

             Summary:  Error Opening PDF in Adobe Reader - The font 
'HoneyScript-Light' contains bad /Widths.
                 Key: PDFBOX-1567
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1567
             Project: PDFBox
          Issue Type: Bug
          Components: FontBox, JempBox
    Affects Versions: 1.7.0
         Environment: Java, Linux , Mac OS
            Reporter: Harippriya Parameswaran
            Priority: Critical



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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to