Hi guys,
Here's what I'm doing

InputStream is =
this.getClass().getClassLoader().getResourceAsStream("com/spidertracks/aviator/service/DINRg__.ttf");
byte[] rBytes = RandomAccessFileOrArray.InputStreamToArray(is);
BaseFont regular = BaseFont.createFont("DIN-Regular.ttf", BaseFont.WINANSI,
true, false, rBytes, null);

However I get the following error:

com.itextpdf.text.DocumentException: Table 'name' does not exist in
DIN-Regular.ttf
at com.itextpdf.text.pdf.TrueTypeFont.getBaseFont(TrueTypeFont.java:502)
at com.itextpdf.text.pdf.TrueTypeFont.process(TrueTypeFont.java:659)
at com.itextpdf.text.pdf.TrueTypeFont.<init>(TrueTypeFont.java:370)
at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:690)
at
com.spidertracks.aviator.service.InvoiceService.generatePDFInvoice(InvoiceService.java:162)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at $Proxy14.generatePDFInvoice(Unknown Source)
at
com.spidertracks.aviator.service.InvoiceServiceTest.generatePdf(InvoiceServiceTest.java:81)
........

For some reason its failing to load get the 'name' field out of the font
file.

However if I create the font as follows it works fine:

BaseFont regular = BaseFont.createFont("
src/main/resources/com/spidertracks/aviator/service/DINRg__.ttf",
BaseFont.WINANSI, true);

its the same file so it doesn't make much sense to me.

Anyone got any ideas??

Also I found a bug somewhere that is unrelated. Is there somewhere that I
can submit it?

Thanks
Matthew
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to