Solved

French characters writing pdf itext

Posted on 2014-04-17
10
730 Views
Last Modified: 2014-04-29
Hello,
  I am converting a html to pdf using itext. THe html file is in French language. SOme characters are getting diaplyed as ? in pdf. Please let me know how to solve this.

Than you
0
Comment
Question by:Sthokala
  • 5
  • 3
  • 2
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 40006659
You need to write them with the correct character encoding. Possibly in your case ISO8859-1
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40006663
Writer out = new OutputStreamWriter(outputStream, "ISO8859-1"));

Open in new window

0
 

Author Comment

by:Sthokala
ID: 40006678
Thank you for your reply. My code is like below

            ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
                  PdfWriter writer = PdfWriter.getInstance(document, pdfOut);
Please let me know where can I specify encoding

Thank you
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40006707
Well i don't know, as i don't know what that PDF class is ...

At a guess, i would think it would accept a UTF-8 encoding
0
 

Author Comment

by:Sthokala
ID: 40006716
it is com.lowagie.text.pdf.PdfWriter;
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 86

Expert Comment

by:CEHJ
ID: 40006740
Since the pdf writer doesn't care about the encoding, it suggests that it chooses its own, which is probably UTF-8. If you're seeing, in the resulting document, bad characters, that suggests that they were already bad before it wrote them
0
 

Author Comment

by:Sthokala
ID: 40006746
I am converting html to pdf. the html file encoding is ISO8859-1, so the data is showing correctly in the html file. When I convert it to pdf, it is not displaying properly
0
 
LVL 16

Expert Comment

by:Valeri
ID: 40006747
this is not because of encoding. you have to choose the right font. the one which is able to "draw" french symbols.
for example check this: http://tutorials.jenkov.com/java-itext/font.html
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 250 total points
ID: 40006763
Yes, definitely font support must be there but i would guess that few fonts are without support for French accents
0
 
LVL 16

Accepted Solution

by:
Valeri earned 250 total points
ID: 40006856
you can try with this font... should be something like that:
BaseFont times = BaseFont.createFont(path + "fonts/times.ttf", "CP1252", BaseFont.NOT_EMBEDDED);
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now