Andreas,
indeed - a downgrade to Version 1.1.0 fixes the problem with the
"/Widths is wrong"-error. Acrobat Reader opens the file without message
and shows the site correctly. The problem with "Apples Preview" remains.
I'll try to keep up with this problem.
Greetings,
Erik
On 21.07.10 13:25, Andreas Lehmkühler wrote:
Hi,
at the moment I'm trying to build a new pdf file with pdfbox (Vers.
1.2.1 / JVM 1.6.0) from the scratch. Unfortunatly, I'm getting errors
when trying to embed fonts: The generated document does not look correct
under "Apple Preview", when opening with "Acrobat" an error ("value for
/Widths is wrong") is shown, but the look of the file is as expected [1].
I tried with several TTFs - all time the same error. I think the fonts
are ok and it must be a mistake by my own.
Can anyone please point me an example where to see how multiple TTFs are
used correctly?
I'm using PDFBox in a similar way and it works fine for me. But I'm still
using version 1.1.0, so that it might be a regression with one of the newer
versions.
Probably this issues is related to [1].
BR
Andreas Lehmkühler
[1] https://issues.apache.org/jira/browse/PDFBOX-696
Here is the code I'm using:
------------------------------------------------------------------------
PDDocument document = new PDDocument();
PDPage page = new PDPage(PDPage.PAGE_SIZE_A4);
document.addPage( page );
PDTrueTypeFont fontBold = PDTrueTypeFont.loadTTF(document,
"DroidSans-Bold.ttf");
PDTrueTypeFont fontRegular = PDTrueTypeFont.loadTTF(document,
"DroidSans.ttf");
PDPageContentStream contentStream = new PDPageContentStream(document,
page);
contentStream.drawLine(18, 747, 580, 747);
contentStream.setFont(fontRegular, 14);
contentStream.beginText();
contentStream.setTextTranslation(20, 750);
contentStream.drawString("Ihr Vorteil durch");
contentStream.setFont(fontBold, 12);
contentStream.setTextTranslation(20, 725);
contentStream.drawString("Pers\u00F6nliche Berechnung f\u00FCr:");
contentStream.setTextTranslation(20, 710);
contentStream.drawString("Bernd Mustermann");
contentStream.endText();
contentStream.close();
document.save(file);
document.close();
------------------------------------------------------------------------
Thanks for all your help,
Greetings,
Erik
[1] http://blog.elitecoderz.net/wp-content/uploads/screen.png
--- original Nachricht Ende ----