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

Free Support Forum - aspose.com

Pagesize issue in pdf

Hi Team,

using Aspose.Pdf for .net 4.7

I am converting pdf to html and then reconverting html back to pdf.
at the time of reconverting html back to pdf …I am setting page size paramerts as original file…but stil I am getting minor difference in page size

these is the code I am using for pdf to html conversion.
HtmlSaveOptions options = new HtmlSaveOptions();
options.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
options.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
options.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;

this is the code I am using to regenerate html back to pdf and setting page size.

HtmlLoadOptions objLoadOptions = new HtmlLoadOptions();

        objLoadOptions.PageInfo.Height = pdf.Pages[1].Rect.Height;//pdf is object of original pdf file.
         objLoadOptions.PageInfo.Width = pdf.Pages[1].Rect.Width;
        objLoadOptions.PageInfo.Margin.Bottom = 0;
        objLoadOptions.PageInfo.Margin.Top =0;
        objLoadOptions.PageInfo.Margin.Right = 0;
        objLoadOptions.PageInfo.Margin.Left = 0;

In Regenerated file I am able to see page is pushed inside leaving white border…and all precedding pages are pushed to next page for some minor part.
please find attached original pdf file , html file and regenerated file .
html reg_pdf.zip (6.7 MB)
original_pdf.zip (3.4 MB)

Can you suggest me a way to solve this issue


Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the difference in our environment. A ticket with ID PDFNET-45825 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.