Each time I go to create a new PDF (IE each request that comes in) I do the 
following.  PDFGenerator.java:920 is in the method below.

        private Map<String, PDFont> buildDefaultFontMap() {
                Map<String, PDFont> pdfBoxFonts = new HashMap<>();
                pdfBoxFonts.put("COURIER", PDType1Font.COURIER);
                pdfBoxFonts.put("COURIER_BOLD", PDType1Font.COURIER_BOLD);
                pdfBoxFonts.put("COURIER_BOLD_OBLIQUE", 
PDType1Font.COURIER_BOLD_OBLIQUE);
                pdfBoxFonts.put("COURIER_OBLIQUE", PDType1Font.COURIER_OBLIQUE);
                pdfBoxFonts.put("HELVETICA", PDType1Font.HELVETICA);
                pdfBoxFonts.put("HELVETICA_BOLD", PDType1Font.HELVETICA_BOLD);
                pdfBoxFonts.put("HELVETICA_BOLD_OBLIQUE", 
PDType1Font.HELVETICA_BOLD_OBLIQUE);
                pdfBoxFonts.put("HELVETICA_OBLIQUE", 
PDType1Font.HELVETICA_OBLIQUE);
                pdfBoxFonts.put("SYMBOL", PDType1Font.SYMBOL);
                pdfBoxFonts.put("TIMES_BOLD", PDType1Font.TIMES_BOLD);
                pdfBoxFonts.put("TIMES_BOLD_ITALIC", 
PDType1Font.TIMES_BOLD_ITALIC);
                pdfBoxFonts.put("TIMES_ITALIC", PDType1Font.TIMES_ITALIC);
                pdfBoxFonts.put("TIMES_ROMAN", PDType1Font.TIMES_ROMAN);
                pdfBoxFonts.put("ZAPF_DINGBATS", PDType1Font.ZAPF_DINGBATS);
                return pdfBoxFonts;
        }

I am using version:
                <dependency>
                        <groupId>org.apache.pdfbox</groupId>
                        <artifactId>pdfbox</artifactId>
                        <version>2.0.1</version>
                </dependency>

I am only using standard fonts that I thought were supplied by PDFBox.
        "HELVETICA"
        "HELVETICA_BOLD"
        "TIMES_BOLD"

Thank you,
Ray

-----Original Message-----
From: Tilman Hausherr [mailto:[email protected]] 
Sent: Wednesday, January 18, 2017 10:55 AM
To: [email protected]
Subject: Re: What causes "Building on-disk font cache"

Am 18.01.2017 um 17:16 schrieb Clark, Raymond C:
> Thank you.  What I don't understand is this:
>
> I have the 1 PDF format.  I repeatedly write it out with different sets of 
> data.  It was working fine, then I got this exception and from then on it 
> failed to create the PDFs.  Why was it able to create PDFs for a while and 
> then decided it needed to write the cache to disk?
>
> I'm wondering if I'm not closing something or cleaning something up that is 
> causing this.  As I said, it worked fine for the first hundred or so and then 
> started failing.

Can you reproduce the effect without using Tomcat? And post that code here? The 
"Building on-disk font cache, this may take a while" message should come only 
once, when PDFBox needs to search what fonts are available on the system. Here 
it does this when creating the ZAPF Dingbats type 1 font. (If the number is 
correct)

What happens at

PDFGenerator.java:920 ?


About your stack trace:

PDType1Font.java:76 - that is the initialization of PDType1Font.ZAPF_DINGBATS

PDType1Font.java:115 - can't find. Did you mention what version you're using?

"Finished building on-disk font cache, found 0 fonts" - do you have 0 fonts on 
your system?


Tilman

>
> Any ideas?
>
> Thank you,
> Ray
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:[email protected]]
> Sent: Wednesday, January 18, 2017 10:10 AM
> To: [email protected]
> Subject: Re: What causes "Building on-disk font cache"
>
> Am 18.01.2017 um 03:47 schrieb Clark, Raymond C:
>> java.io.FileNotFoundException:/opt/tomcat/.pdfbox.cache (Permission denied)
>
> Normally this should be written in the user directory... you can set
> this by setting the property   pdfbox.fontcache
>
> Here's a code excerpt:
>
>
>       private File getDiskCacheFile()
>       {
>           String path = System.getProperty("pdfbox.fontcache");
>           if (path == null)
>           {
>               path = System.getProperty("user.home");
>               if (path == null)
>               {
>                   path = System.getProperty("java.io.tmpdir");
>               }
>           }
>           return new File(path, ".pdfbox.cache");
>       }
>
>
> ________________________________
>
> CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are 
> intended solely for the use of the individual or entity to whom they are 
> addressed and may contain confidential and privileged information protected 
> by law. If you received this e-mail in error, any review, use, dissemination, 
> distribution, or copying of the e-mail is strictly prohibited. Please notify 
> the sender immediately by return e-mail and delete all copies from your 
> system.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>


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

Reply via email to