Need to change the page margins of existing PDFs

Hello,

We are creating business letters on letterhead, from HTML content. We need to convert incoming formatted HTML to PDF, maintaining control over page margins so that the first page can have margins for the letterhead, and subsequent pages can have different margins.

Requirements:
Input: Any arbitrary HTML.
Output: A PDF containing the HTML content with formatting intact, flowing from page to page for as many pages as required. The first page must have different page margins than the rest of the pages.

The HTML to PDF conversion is more accurate when done by Aspose.Words than the output of Aspose.Pdf.Generator using IsHtmlTagSupported, so I’d like to use Aspose.Words for the initial conversion, then adjust the page margins for the first and subsequent pages. Aspose.Pdf.Generator.Pdf introduces HTML rendering bugs that can be seen with my attached demo project (table is broken, UL indents are missing). However, I couldn’t find a way to load a PDF created by Aspose.Words so that I could change page margins.

So ultimately it boils down to: we need to be able modify the page margins of an existing PDF (one that is created by Aspose.Words) without harming the PDF contents.

Please refer to the demo project to see the strategy I was trying: creating a new PDF with Aspose.Pdf.Generator.Pdf, using IsHtmlTagSupported to bring in the HTML, setting all page margins to those of my first page, then saving a temp PDF. My next step was to again use Aspose.Pdf.Generator.Pdf to create a copy of the temp PDF, assigning each Paragraph to its own Section so I could determine which Paragraph appeared on which page and set that Section’s page margins appropriately. This strategy failed in several ways as can be seen by the (also attached) output of the test project. I was also unable to control the page margins, which was the point of the tests.

Is what I’m trying to do possible with Aspose components? If so, how? Please help.

I’m using the latest version of the components.

Thanks

Allan Sampson

AllanX:
The HTML to PDF conversion is more accurate when done by Aspose.Words than the output of Aspose.Pdf.Generator using IsHtmlTagSupported, so I'd like to use Aspose.Words for the initial conversion, then adjust the page margins for the first and subsequent pages. Aspose.Pdf.Generator.Pdf introduces HTML rendering bugs that can be seen with my attached demo project (table is broken, UL indents are missing).

Hi Allan,

Thanks for using our products. I have tested the scenario using Aspose.Pdf for .NET 6.4.2 and as per my observations, the out put generated with this version is quite better as compare to the one which you are have generated (while using Aspose.Pdf for .NET 6.3.0). But still the output generated with Aspose.Pdf for .NET 6.4.2 has some issue while rendering the table cells. For the sake of correction, I have logged this problem as PDFNEWNET-32217 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

AllanX:
However, I couldn't find a way to load a PDF created by Aspose.Words so that I could change page margins.So ultimately it boils down to: we need to be able modify the page margins of an existing PDF (one that is created by Aspose.Words) without harming the PDF contents.

We are working over this requirement and will get back to you soon.

AllanX:
Please refer to the demo project to see the strategy I was trying: creating a new PDF with Aspose.Pdf.Generator.Pdf, using IsHtmlTagSupported to bring in the HTML, setting all page margins to those of my first page, then saving a temp PDF. My next step was to again use Aspose.Pdf.Generator.Pdf to create a copy of the temp PDF, assigning each Paragraph to its own Section so I could determine which Paragraph appeared on which page and set that Section's page margins appropriately. This strategy failed in several ways as can be seen by the (also attached) output of the test project. I was also unable to control the page margins, which was the point of the tests
Aspose.Pdf.Generator supports the feature to create PDF documents from scratch and I am afraid it lacks the capabilities to manipulate/edit existing PDF files. We are really sorry for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-32217) have been fixed in this update.


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