Am 20.01.2017 um 21:39 schrieb Clark, Raymond C:
Hi,
Sometimes I am getting the following error:
[log4j][ServiceQueueSyncProcessThread: '2' for queue
ProductsStmtService][2017-01-19 20:42:21,675]
org.apache.pdfbox.pdmodel.font.PDCIDFontType2 WARN Using fallback font
LiberationSans for CID-keyed TrueType font ArialMT
In my code I am always setting the PDFont object to Arial:
PDDocument document = new PDDocument();
File fontFile = new
File(getClass().getClassLoader().getResource("Fonts/arial.ttf").toURI());
PDFont font = PDType0Font.load(document, fontFile);
My code generates a PDF every time it gets a request. Sometimes I get this
message and sometimes I don't and all of the time I am using the Arial font.
When I do get this message it seems to appear every time that I am calling to
put text on that PDF. Then the next request may not have this message while
processing.
Any ideas as to why this message is coming out?
Any ideas as to why it would only come out sometimes?
It means that it can't find the ArialMT font (or a similar one, e.g.
Helvetica) on your system fonts, so it uses the last resort which is
LiberationSans. I don't know why you get it sometimes and sometimes not.
I'm also wondering why you would get it related to a PDType0Font.load()
call.
As I said before, the best would be
- update to the latest version so that we can be sure that the problem
still happens
- solve the other problems you mentioned
- create a scenario where this happens regularly, preferably without tomcat
- share that code
If you can't do that, then build from source and modify
PDCIDFontType2.java like this:
-LOG.warn("Using fallback font " + ttfFont.getName() + " for CID-keyed
TrueType font " + getBaseFont());
+LOG.warn(new Exception(), "Using fallback font " + ttfFont.getName() +
" for CID-keyed TrueType font " + getBaseFont());
Btw you can also use PDType1Font.HEVETICA, unless embedding is important
for you, e.g. because you create a PDF/A file.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]