the last months I generates thousends of pdfs (on Windows 7 while developing, OpenSuse while test & production) with font Courier.
Now I got the goal to use Arial. So I switched the font name in our property files and i got this exception:
Stacktrace snippet: com.itextpdf.text.DocumentException: Font 'Arial' with 'Cp1252' is not recognized. at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:708) at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:615) at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:450)
After googleing a while I found a solution. I just have to use "Arial.ttf" (like the filename) in the settings. But after that, I got another exception:
java.io.IOException: Arial.ttf not found as file or resource. at com.itextpdf.text.io.RandomAccessSourceFactory.createByReadingToMemory(RandomAccessSourceFactory.java:224) at com.itextpdf.text.io.RandomAccessSourceFactory.createBestSource(RandomAccessSourceFactory.java:173) at com.itextpdf.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrArray.java:147) at com.itextpdf.text.pdf.TrueTypeFont.process(TrueTypeFont.java:625) at com.itextpdf.text.pdf.TrueTypeFont.<init>(TrueTypeFont.java:369) at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:699) at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:615) at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:450)
So the hint there is, that itextpdf is looking for a file right now. So I just typed the filename C:\\Windows\\Fonts\\Arial.ttf
into our config.
Now it works!
But the goal is just to use "Arial" as the fontname. Is it possible?
Thanx a lot!