I'm currently using iText PDF Lib (5.4.3)
When I used iText PDF ver 5.1.x
It's working good export Korean Language.
But when I changed latest version(5.4.3) .
It can't export Korean Language.
I was tried set Chartset also.
XMLWorker worker = new XMLWorker(pipeline, true);
XMLParser xmlParser = new XMLParser(true, worker, Charset.forName("euc-kr"));
document.open();
xmlParser.parse(strReader);
document.close();
And I checked font(malgun.ttf) also.
But, still it's not working.
I don't know what I missed something... :(
Please help..
Thanks.!
please read the changelogs of iText, more specifically for version 5.2.0. From this version on, you need to replace the iTextAsian.jar (see extra jars directory) because we changed the way CJK fonts are used.
Related
Is DOCX viewer in flutter possible.
I have tried PDFTron, it has the following drawbacks:
Not a widget
Paid version
If DOCX viewer is not available, then is DOCX to PDF converter available?
Use ConvertAPI, but if you want and offline solution i do not believe i came across one or you can useFFI if you found a native code for conversion
You can take a look to flutter_filereader package. It has a lot of file types. I suggest to you.
This question already has answers here:
RTL not working in pdf generation with itext 5.5 for Arabic text
(3 answers)
Closed 4 years ago.
For my website, I use itextpdf 5.5.4 to generate PDF downloads. The website is meant for people who speak English. Recently, a user from Egypt used the site, entered some Arabic content, and contacted me with the problem he has.
This is his Arabic content shown correctly in the browser:
This is incorrect display in PDF:
Here is the Java code I have. Please note that it is actually able to generate PDF with Chinese characters CORRECTLY:
BASE_FONT base = BaseFont.createFont("/fonts/ARIALUNI.ttf", BaseFont.IDENTITY_H , BaseFont.EMBEDDED);
Font f = new Font(base, 10f);
String htmlString = string_with_Arabic_text;
Paragraph p = new Paragraph(htmlString, f);
p.setSpacingBefore(20.0f);
p.setSpacingAfter(7.0f);
document.add(p);
How to fix the problem?
In Eclipse (the IDE I use), I am able to see Arabic characters display correctly in htmlString. At this moment, I cannot upgrade to use the latest version of itextpdf due to various project reasons.
iText 5 has limited support for non-Western writing systems. It support right-to-left writing but only in the context of ColumnText and PdfPCell objects.
This is an iText 5 example with ColumnText where p contains text in Arabic:
ColumnText canvas = new ColumnText(writer.getDirectContent());
canvas.setSimpleColumn(36, 750, 559, 780);
canvas.setRunDirection(PdfWriter.RUN_DIRECTION_LTR);
canvas.addElement(p);
canvas.go();
This is an iText 5 example with PdfPCell where p contains text in Arabic:
PdfPCell cell = new PdfPCell(p);
cell.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
This is very annoying, as it would mean that you have to rewrite your entire application so that all text is added either in a ColumnText or in a PdfPCell object. You'd also have to examine the content to check if you need to change the run direction.
As you have to rewrite the application anyway, it would be best to upgrade to iText 7, because iText 7 has an add-on that detects the writing system based on the UNICODE values of the content (see pdfCalligraph). When Arabic or Hebrew text is detected, the add-on changes the writing system for "left to right" to "right to left." See How to display Arabic strings from RTL in PDF generated using itext 7 API?
I see that you are coding your document. Please note that you can save yourself a lot of work by creating the content in HTML, and then converting it to PDF using the pdfHTML add-on. The PDF to HTML tutorial has some examples involving Arabic. See the section on internationalization in chapter 6, and the following FAQ entries:
Which languages are supported in pdfHTML?
How to convert HTML containing Arabic/Hebrew characters to PDF?
iText 7 is also the first version that supports more writing systems, such as Devanagari, Tamil, Telugu,... For more info, read the pdfCalligraph white paper.
Important: the pdfCalligraph add-on is closed source. You'll need a trial license to test it and a commercial license to use it in production. Note that the current version of iText that you are using is licensed as AGPL software, which implies that you can't use your project in a closed source context. You mention external users, which means that you are distributing your service. Did you open source all your own source code? If not, you should purchase a commercial license for your use of iText.
I'm using PDFTable from http://www.vanxuan.net/tool/pdftable/ which is based on FPDF class. I managed to export HTML table to pdf using PDFTable. However, I'm facing one issue. The non-English characters are all displayed in gibberish. It doesn't seem that it supports unicode. The language I'm trying to display is Arabic and Russian.
I could, theoretically, create a similar class to PDFTable, which is inherited from FPDF, and develop it from scratch to add unicode support. But it's a lot of work. Has anyone done something like that and perhaps could share? Thank you!
For unicode support, the best way is to use tFPDF from http://www.fpdf.org/en/script/script92.php. It's a fork of FPDF with specifically to support unicode. The class is based on the latest FPDF version 1.7.
I've been using the code sample from iText in Action (8.7.2) to deal with the "cannot save" issue with PDF forms and iTextSharp. It was working fine, but recently the fix stopped working and all the variations of the code listed in the book to prevent the saving problem haven't solved it.
I'm using the latest version of the iTextSharp library. Has anyone else run into this? Did an Acrobat update break it?
works for me using iTextSharp 5.0.6, Reader X, and Listing 8.29 ReaderEnabledForm from the book. (it's the file named 'xfa_preserved.pdf' in the zip download)
IIRC the last couple of times i saw similar on the mailing list, the problem was specific to how the original PDF was created. if you subscribe, you can post the original PDF and hopefully one of the experts can take a look if they have time.
I have to store some documents in the docx format, but can't stand using msword: I would like to edit some kind of plain text markup, anything except stuff based on XML (I don't like that either) and convert from/to that to/from docx.
Are there any options for this?
EDIT: since people think this is not programming related, I'll extend my question. What libraries do you suggest for writing a complete tex-docx/docx-tex converter?
If you're talking .net, I'd check out the OpenXML toolkit first. There are lots of "libraries" on the internet to do this, but they all seem to just be thin wrappers around the OpenXML stuff.
You might also check out
http://openxmldeveloper.org/
Aspose.Words for .NET allows you to create DOCX files from scratch using text or other content and then convert DOCX files to text etc. It doesn't require MS Office to be installed on the system. And the component is a simple .NET assembly with an easy to learn and implement API. Please try and see if it helps in your scenario.
Disclosure: I work as developer evangelist at Aspose.
You can try the DocxEditorKit http://java-sl.com/docx_editor_kit.html
Set the editor kit to JEditorPane, add styled text and store the document in docx format.