pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: PDFont - thread save?
Date Fri, 09 Oct 2015 00:43:25 GMT
No, it’s not thread safe. Nor is it safe to share a PDTrueTypeFont across multiple
PDDocument instances.

Read-only access to PDFs is “mostly” thread safe now, though we promise nothing,
however write-access to PDFs is definitely not.

— John

> On 8 Oct 2015, at 02:59, M. Niedermair <m_g_n@gmx.de> wrote:
> 
> Hello there,
> 
> I load the font "Linux Libertine" in a factory as a singleton (I create several hundred
PDFs with this font.).
> 
> libertine_R = PDTrueTypeFont.loadTTF(document,
>   FontLibertine.class.getResourceAsStream("ttf/LinLibertine_Rah.ttf"));
> 
> In single-threaded, this also works without problems.
> But if I start multiple threads that use the Font singelton, there is an error. I run
four threads per core (4x8 = 32).
> 
> As a stopgap, I load the font in each thread individually.
> Is there a better solution?
> 
> Michael
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message