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

Free Support Forum - aspose.com

Htm with tables

Hi,


I need to convert the attached htm document to a pdf but by using the save with a pdf file the tables are out of the pdf’s range (as you can see in the attached file).

Is there a way to solve this?

There also is an @page css rule in the document. Is it possible for aspose to use this css?

Greetings,
Michiel
Hi Michiel,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.8.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7054. Your request has been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Moreover, in your case, please use the following code snippet as a temporary workaround:

Document doc = new Document(@"C:\Temp\HotScreen1.htm");

foreach (Table tbl in doc.FirstSection.Body.Tables)

{

tbl.AutoFit(AutoFitBehavior.AutoFitToWindow);

}

doc.Save(@"C:\Temp\out.pdf");



I hope, this will help.

Best Regards,

Hi,


Thanks for the reply.

Looking at the issueid it looks like you logged the issue for the .NET version.
Can I point you to the fact that I’m having this problem in the java version.

Greeting,
Hi Michiel,

Thanks for your inquiry.

Please note that the latest version of Aspose.Words for Java is completely auto-ported from .NET, i.e. we do not write code for Aspose.Words for Java; it is generated out automatically from C# code of Aspose.Words for .NET. In your case, the issue, that was previously logged with WORDSNET prefix, would be auto resolved for Java variant of Aspose.Words as well. Your problem will be fixed as soon as the linked issue is resolved.

Best Regards,

Hi,


I’m trying to use the fix you provided but I still have the same result.
Underneath is the code I used.

Document doc = new Document("./test.htm");
TableCollection tables = doc.getFirstSection().getBody().getTables();
for (int i = 0 ; i > tables.getCount() ; i++)
{
tables.get(i).autoFit(AutoFitBehavior.AUTO_FIT_TO_WINDOW);
}
doc.updatePageLayout();
doc.save("./test.pdf");

Hi Michiel,


Thanks for your inquiry. Could you please attach your html file (test.htm) here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

The test.htm file is the same file as in the first post I just renamed. I reattached it to this post.

Hi Michiel,


Thanks for your inquiry. I have attached the PDF file i.e. produced on my side here for your reference. Please create a screen shot that highlights the problematic areas in the attached PDF and attach it here for our reference. We will look further into the details of your problems and provide you more information.

Best Regards,

could you please provide the code u used to create this file? I do not get the same result.In the attachment you find my result.

Hi Michiel,


Thanks for your inquiry. I used the code mentioned in the following article to generate PDF document:
http://www.aspose.com/docs/display/wordsjava/How+to++Convert+a+Document+to+PDF

Moreover, it seems you’re using an old version of Aspose.Words (11.7.0) on your side; I would suggest you please upgrade to the latest version of Aspose.Words i.e. 11.9.0 from the following link:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

I hope, this helps.

Best Regards,

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


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