pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunrita Bagchi Basu <sunrita....@gmail.com>
Subject Re: Printing non english characters in a PDF with PDFBox 1.8.10
Date Thu, 25 Feb 2016 05:47:16 GMT
Thanks for the quick tip. I moved to 2.0.0-RC3 . Now I'm getting the
following exception for the following line of code:

            float size = CreatePDF.fontSize *
PDType1Font.HELVETICA_BOLD.getStringWidth(subString) / 1000;


java.lang.IllegalArgumentException: U+FFFD ('.notdef') is not available in
this font's encoding: WinAnsiEncoding
at org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:344)
at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:285)
at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:314)
at
com.evolv.dataflow.compliance.pdf.PDFColumn.createContent(PDFColumn.java:74)
at com.evolv.dataflow.compliance.pdf.PDFColumn.<init>(PDFColumn.java:40)
at
com.evolv.dataflow.compliance.pdf.CreateUserPDF.createPDFRow(CreateUserPDF.java:89)
at
com.evolv.dataflow.compliance.pdf.CreateUserPDF.createPDFRow(CreateUserPDF.java:1)
at com.evolv.dataflow.compliance.pdf.CreatePDF.lambda$0(CreatePDF.java:234)
at
com.evolv.dataflow.compliance.pdf.CreatePDF$$Lambda$1/992768706.accept(Unknown
Source)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at
com.evolv.dataflow.compliance.pdf.CreatePDF.CreatePDFDocument(CreatePDF.java:234)
at com.evolv.dataflow.compliance.pdf.TestPDF.testUserPDF(TestPDF.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


On Thu, Feb 25, 2016 at 10:43 AM, Tilman Hausherr <THausherr@t-online.de>
wrote:

> Hi,
>
> You can't. Use the 2.0RC3 version. The API to create PDF is slightly
> different, see the examples in the source download.
>
> Tilman
>
>
> Am 25.02.2016 um 05:13 schrieb Sunrita Bagchi Basu:
>
>> Hi All,
>>
>> I am creating a PDF document with a simple table where i write my Data.
>> Most of my data is plain english, but sometimes there are some non
>> english characters
>> too like french , japanese. Whenever these characters apprear, the font
>> style (that I have chosen for my PDF) changes! There's junk characters with
>> lots of white space in between.I tried the following:
>>
>> 1. removing the non english characters
>> 2. extracting the data using UTF-8 charset
>>
>> but non of it works! Attached is the sample of the font change.
>> How to tackle this ?
>>
>>
>> ---------------------------------------------------------------------
>> 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