pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Prusinowski <peter.pr...@gmx.de>
Subject Re: Loading TTF once and generating multiple documents with
Date Mon, 15 Feb 2016 09:37:30 GMT
@ tilman :
You are right :-)

@ john :
I did not know FontBox. How can I pass the TrueTypeFont object to the 
PDTrueTypeFont Constructor ?

Am 12.02.2016 um 16:54 schrieb John Hewson:
>> On 12 Feb 2016, at 01:25, Peter Prusinowski <peter.prusi@gmx.de> wrote:
>>
>> Hi,
>>
>> I like to generate multiple PDF documents with images and text. I am using a TTF
font and my goal is to load the font once in the constructor of my class and then to create
multiple documents with this font.
>>
>> I try to load the font with "PDType0Font.load(new PDDocument(), File)" and then call
my method three times to create three identical documents.
>> The first document is created successful, but the next throwing "java.io.IOException:
The TrueType font does not contain a 'cmap' table".
>>
>> If I load the font with "PDTrueTypeFont.loadTTF(new PDDocument(), File)", I can create
three documents, but only with text.
>> Adding an image "PDImageXObject img = LosslessFactory.createFromImage(doc, bufferedImage)"
ends up with throwing "java.io.IOException: Scratch file already closed".
>>
>> Is it possible to load the font only once at all ?
> Each PD object represents something in an individual PDF file, so they can't be shared
across files. But you can load the font file only once using FontBox's TrueTypeFont and then
pass that to multiple PDTrueTypeFont constructors.
>
> -- John
>
>> I am using PDFBox 2.0.0-RC3 and here is a code snippet http://pastebin.com/wrvUrZJR
>>
>> Thank you.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message