[ 
https://issues.apache.org/jira/browse/PDFBOX-2539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15018293#comment-15018293
 ] 

John Hewson commented on PDFBOX-2539:
-------------------------------------

This was discussed on the [mailing 
list|http://pdfbox-dev.markmail.org/search/?q=threadlocal#query:threadlocal+page:1+mid:y3nzkm74jhc4xoeb+state:results]
 recently. Basically, PDFBox's architecture can't support per-document 
FontProvder(s) because PDDocument and PDFont have entirely separate lifecycles, 
including static instances of PDType1Font for the base 14 fonts which aren't 
tied to any particular document. Additional changes based on this discussion 
were made in PDFBOX-2997.

The solution is to use ThreadLocal in your custom FontProvider, that way each 
thread has its own PDDocument and its own FontProvider. That'll get you the 
result you're after.

> [PATCH] Allow non static FontProvider
> -------------------------------------
>
>                 Key: PDFBOX-2539
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2539
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: simon steiner
>         Attachments: fontProvider.patch
>
>
> I would like to use multiple instances of fontprovider in thread safe way



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to