Issue with adding Headers/Footers to PDF

78 Views Asked by At

Aspose Version: 22.2.0 Code: .net

Out current process is as follows:

We Save a Docx as a PDF to a local directory We load that PDF into a Document We loop through each page of the document and add different Headers/Footers as needed based on client configuration. We save the PDF file for access by the customers. He Header/Footer being saved is primarily in HTML so we use the following code to add them to the pages.

enter image description here

The problem that is occurring during this process is that the text is duplicating in the Header/Footer of the document.

Here is the document being converted to PDF (This document was also created by Aspose)

Docx before it is PDF

Here is the PDF with the Headers/Footers and both duplicate. The header appears twice and the footers appear over the top of each other causing it to look garbled.

Problem PDF

I have tried to adjust the code with varying results, when adjusting and debugging the code I was able to get it to remove the duplication but that is due to the header being adding in the same location multiple times which causes the text to become bold. You can see what I’m referring to below on the 1st page the text looks bold and on the second it appears normal. When I would removed setting the margins is when the header stopped duplicating but then was appearing bold.

PDF with slight adjustments

0

There are 0 best solutions below