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

Free Support Forum - aspose.com

Issue in Page Size after HTML Conversion

Hi Team

I am converting pdf file into html
and then regenerating pdf back from html.

I want regenerated pdf with same page size as original pdf.

what are the parameters I need to copy from original pdf before saving regenerated pdf.

I already setted folowwing parameters equal but not worked

pdf.pageinfo.margin.top=pf1.pageinfo.margin.top…similary bottom/right/left
pdf.pageinfo.height=pd1.pageinfo.height…similarly width

can you suggest me correct way to generate same size pages from html as original pdf

@kotharishrey

Thanks for contacting support.

You may please specify page height and width by setting properties of HtmlLoadOptions as following:

Aspose.Pdf.HtmlLoadOptions objLoadOptions = new Aspose.Pdf.HtmlLoadOptions();
objLoadOptions.PageInfo.Margin.Bottom = 0;
objLoadOptions.PageInfo.Margin.Top = 0;
objLoadOptions.PageInfo.Margin.Right = 0;
objLoadOptions.PageInfo.Margin.Left = 0;
objLoadOptions.PageInfo.Width = 595.27584; // 21cm to points
objLoadOptions.PageInfo.Height = 841.88952; // 29.7cm to points

In case above suggestions do not work as per your expectations, please share your sample input output files with us along with complete code snippet. We will test the scenario in our environment and address it accordingly.

Hi team ,

Thanks for your quick response.

this is working fine for a4 size page documents.

when I am trying to work on different page size document…I am not able to regenerate document.

I am sending some files for your reference
Here two pages are merged into one page.

original file- file.pdf
html - Output.html
regenerated file- final.pdfPDF.zip (8.9 MB)

I am always getting pdf.Pageinfo.Width=595 and pdf.PageInfo.height=849
for different page size also.

@kotharishrey

Thanks for writing back.

Could you please share complete code snippet which you are using to generate HTML from PDF. It would help us testing the scenario in our environment and address it accordingly.