Arabic problems with converting html to PDF using ITextRenderer

When I use ITextRenderer converting html to PDF.this is my code

ByteArrayOutputStream out = new ByteArrayOutputStream();

ITextRenderer renderer = new ITextRenderer();
String inputFile = "C://Users//Administrator//Desktop//aaa2.html";
String url = new File(inputFile).toURI().toURL().toString();
renderer.setDocument(url);
renderer.getSharedContext().setReplacedElementFactory(
        new B64ImgReplacedElementFactory());
    // 解决阿拉伯语问题
ITextFontResolver fontResolver = renderer.getFontResolver();
try {
    fontResolver.addFont("C://Users//Administrator//Desktop//arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
} catch (DocumentException e) {
    e.printStackTrace();
}

renderer.layout();
OutputStream outputStream = new FileOutputStream("C://Users//Administrator//Desktop//HTMLasPDF.pdf");
renderer.createPDF(outputStream, true);
/*PdfWriter writer = renderer.getWriter();

writer.open();
writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
OutputStream outputStream2 = new FileOutputStream(  "C://Users//Administrator//Desktop//HTMLasPDFcopy.txt");
renderer.createPDF(outputStream2);*/
renderer.finishPDF();
out.flush();
out.close();

Actual PDF Result:

Expected PDF Result:

How to make arabic ligature?

Arabic problems with converting html to PDF using ITextRenderer, When I use ITextRenderer converting html to PDF.this is my code ByteArrayOutputStream out = new ByteArrayOutputStream(); ITextRenderer renderer = new  Output: The code above will create a PDF file string-to-pdf.pdf. Converting HTML File to PDF. We can convert HTML file to PDF using the same method convertToPdf() that takes HTML as InputStream and write the PDF content into OutputStream. The HTML file can contain CSS file and images. However, they need to be in the same location of the HTML file.

Greek characters seemed to be omitted; they didn’t show up in the document.

In flying saucer the generated PDF uses some kind of default (probably Helvetica) font, that contains a very limited character set, that obviously does not contain the Greek code page. link

iText 5-legacy : How to convert Arabic HTML to PDF?, When I use ITextRenderer converting html to PDF.this is my code ByteArrayOutputStream out = new ByteArrayOutputStream(); ITextRenderer renderer = new  Text appears to melt or characters overlap. Text is scrambled, garbled, or displays as "garbage" characters. Some text appears in subscript. Text prints incorrectly. Solution: Embed fonts to avoid font substitution. Embedding prevents font substitution when readers view or print the file and ensures that readers see the text in its original font.

I change the way to convert pdf by using wkhtmltopdf.

Arabic characters not converted to PDF · Issue #24 · hhandoko/play2 , I am having difficulties displaying Arabic Characters from HTML content in PDF. The characters are generated as "?" characters. I am able to  Hi all I am trying to convert a large size word document ( 86 pages) to a PDF file. I am having a problem with the pages. they seem not to match and it creates a big mess specially regarding page numbers, for example my page looks something like this

Convert HTML to PDF using iText, Expected Behaviour Aabic Charaters are not converted to pdf format Actual on html format: Steps to Reproduce 1- set an exemle.scala.html with arabic characte.​.. Issues 4 · Pull requests 1 · Actions · Projects 0 · Security 0 · Insights 2- Load an arabic font in ApplicationModule.scala using pdfGen. Indeed, the OP is using a third party tool called "Flying Saucer." Flying Saucer uses an old iText version that doesn't support ligatures. See How to convert HTML containing Arabic/Hebrew characters to PDF? in the FAQ section of the official HTML to PDF tutorial. – Bruno Lowagie Dec 14 '17 at 16:06

Problem in Arabic Character when convert Html to PDF, Using iText HTMLWorker, you can produce PDF version of an HTML document. The document must be simple. Many things like FORM elements or external  image is not displayed after generating the pdf of folder where you store PDF files and in your html, just use folder where images are: angular 6 to convert

iText library - Similar Threads, the characters are shown separated. you can find the result in attach. please note that I'm using sample code from the site. please find my code :. In this blog, I will demonstrate how to generate a PDF file of your HTML page with CSS using JavaScript and Jquery. Convert HTML To PDF, generate PDF from html. In this blog, I will demonstrate how to generate PDF file of your HTML page with CSS using JavaScript and jQuery. In this blog, we have to add two external JS files for converting the

Comments
  • Indeed, the OP is using a third party tool called "Flying Saucer." Flying Saucer uses an old iText version that doesn't support ligatures. See How to convert HTML containing Arabic/Hebrew characters to PDF? in the FAQ section of the official HTML to PDF tutorial.
  • I change the way to convert pdf by using wkhtmltopdf.