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

Free Support Forum - aspose.com

HTML to pdf conversion out is not match with givne Html Input using aspose.word for java

Dear support team,
I am converted html code to pdf but its not given desire out put. Please compare attached html.zip with generated output in pdf(ouptut1.pdf). Over their compare following points:

  1. Hindi Text not getting exactly what in Html
  2. Image is not well readable format.
  3. Table truncation right most colums are truncated in pdf.

I used following code for Html to pdf conversion

Code :

public static void convertHtmlToDoc()
{
    Document doc;
    try
    {
        doc = new Document("F:/nitin/modules/Aspose/testing/data/html/Aspose_DocToHTML.html");
        doc.save("F:\\nitin\\modules\\Aspose\\testing\\data\\ouptut1.pdf");

    }
    catch (Exception e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

Hi Nitin,

Thanks for your inquiry.

*nitinchopkar:

  1. Hindi Text not getting exactly what in Html
  2. Image is not well readable format.*

I have tested the scenario and have managed to reproduce the same
issues at my side. For the sake of correction, I have logged these
problems in our issue tracking system as follow:

WORDSNET-12313 : Table’s cell width is changed in output Pdf (Hindi Text issue)
WORDSNET-12314 : Html to Pdf conversion issue with shape rendering (images rendering issue)

I
have linked this forum thread to the same issues and you will be
notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

*nitinchopkar:

  1. Table truncation right most colums are truncated in pdf.*

You are facing this output because the width of table is greater then the width of page. You need to change the size of page. Please check following code example. You may also use this code example as a workaround of shared issues.

Document doc = new Document(MyDir + " Aspose_DocToHTML.html");
doc.getFirstSection().getPageSetup().setPageWidth(1000);
Table table = (Table)doc.getChild(NodeType.TABLE, 0, true);
table.setPreferredWidth(PreferredWidth.fromPercent(100));
for (Row row : table.getRows())
    row.getCells().get(1).getCellFormat().setWidth(200);
doc.save(MyDir + "Out.pdf");

Thanks
the table truncation issues are solved with provided code.

I am waiting for remaining two issues that Hindi Text and Image issues.

Hi Nitin,

Thanks for your inquiry. We will inform you via this forum thread once these issues are resolved.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Please update us regarding remaining issues while generating pdf.

Hi Nitin,

Thanks for your inquiry. I would like to
share with you that issues are addressed and resolved based on first
come first serve basis. Currently, your issues are pending for analysis
and are in the queue. I am afraid, we can’t provide you any reliable
estimate at the moment. Once your issues are analyzed, we will then be
able to provide you an estimate.

Thanks for your patience and understanding.

The issues you have found earlier (filed as WORDSNET-12314) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi support team,
we downloaded that aspose word for java latest update 15.9.0 , but we are seen problem is not resolved. The same problem mention earlier post that 1) Hind Text issues not getting exact like html representation. 2) Image is not cleared as in html.

Generated pdf file is attached here with html zip file. Please check it once again.

From
NItin Chopkar
(Techior Solutions Pvt. Ltd.)

Hi Nitin,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you load the same html in MS Word and convert it to Pdf, you will get the same output.

Moreover, please compare the Pdf file attached in your first post and previous post. The output of v15.9.0 looks much better as compare to the output of older version of Aspose.Words.

*nitinchopkar:

  1. Hind Text issues not getting exact like html representation.*

You are getting this issue because the page size of document is less then table’s width. Please use PageSetup.PageWidth to increase the width of page size. Once the page size is bigger, the output will be same as html.

*nitinchopkar:

  1. Image is not cleared as in html.*

Please open html document in MS Word and save it to Pdf. Zoom the pdf to 100% and compare the Pdf files generated by MS Word and Aspose.Words. You will get the same output.

Hope this answers your query. Please let us know if you have any more queries.