We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text does not wrap and space disappear while convert html to pdf


After we convert html to pdf using Aspose.PDF, we found some problem in result pdf file.

  1. text doesn’t wrap right
  2. we have some space between “:” character in html but space disappear in result pdf file

this s our code:

package test.fileconvert;

import com.aspose.pdf.Document;
import com.aspose.pdf.HtmlLoadOptions;

import java.nio.file.Paths;
import java.util.Locale;

public class ConvertHTMLtoPDF {

public static void main(String[] ags) throws Exception {
    String filePath = "./ArabicTest";
    Locale.setDefault(new Locale("en-us"));

private static void ConvertHTMLtoPDF_Simple(String filePath) {
    // Create a HTML LoadOptions
    HtmlLoadOptions options = new HtmlLoadOptions();

    // Initialize document object
    String htmlFileName = Paths.get(filePath, "Arabic.html").toString();
    Document document = new Document(htmlFileName, options);

    // Save output PDF document
    document.save(Paths.get(filePath, "HTMLtoPDF.pdf").toString());



here is html and pdf file:
testfile.zip (36.0 KB)
1.png (86.0 KB)


I have created attached file with latest version. Can you please highlight the issue with snapshot for our investigations. HTMLtoPDF.pdf (38.9 KB)


thank you for your reply.
Seem the pdf width isn’t A4’s width. While we set our page width as A4, the text will exceed the width limit1.png (86.0 KB)


A ticket with ID PDFJAVA-40949 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.