Details
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
- duplicates
-
PDFBOX-954 Embedded font: value for /Widths faulty (worked in PDFBox 1.3.0!)
- Closed