Word generated to pdf - Margin of the pdf head and footer set different from the word

I generated Word to pdf and added stamps of header and footer to the pdf.
you can see in the Word that the header and footer margin is equal on all pages 2.54 header and footer
but after generating the word to pdf, page 4 got overlap by the stamp unlike page 3 which displays well without overlap and as I said you can see that the margin in those 2 pages is the same
issue.docx (52.6 KB)
issue.pdf (1018.4 KB)
image.png (71.1 KB)

@operationsdotbcs Could you please provide the code that is used to add header/footer to the document? Simple conversion from Word to PDF document allow us to preproduce the problem. Alternatively, you can save the output document as DOCX (with added header/footer) and attach it here for testing. We will check the issue and provide you more information.

public void setAllHeadersAndFooters(FileData_v5 fileData, Set<String> pageSizeSet, Map<Integer, String> pageSizeMap,
		Document pdfDocument, int totalNumOfPages) throws IOException {
	if (!fileData.getIgnoreTemplate()) {
		Map<String, Document> mapTemplateNameToPdfDoc = new HashMap<String, Document>();
		for (String pageSize : pageSizeSet) {
			getTemplateFromSF(fileData, pageSize, mapTemplateNameToPdfDoc);
		}
		for (int n = 1; n <= totalNumOfPages; n++) {
			Document pdfTemplaeDocument = mapTemplateNameToPdfDoc
					.get(fileData.getFileId().concat("-Template-").concat(pageSizeMap.get(n)).concat(".pdf"));
			PdfPageStamp pageStamp = new PdfPageStamp(pdfTemplaeDocument.getPages().get_Item(1));
			//pageStamp.setYIndent(10);
			pageStamp.setBackground(false);
			pdfDocument.getPages().get_Item(n).addStamp(pageStamp);
		}
	}
}

@operationsdotbcs As I can see you are adding Header/Footer into the document by postprocessing the PDF produced by Aspose.Words. So I think the problem is related to Aspose.PDF not to Aspose.Words. I will move your request to Aspose.PDF forum. My colleagues will help you shortly.
As An alternative, I can suggest you to add header/footer and watermark using Aspose.Words before saving the document to PDF:
https://docs.aspose.com/words/net/working-with-headers-and-footers/
https://docs.aspose.com/words/net/working-with-watermark/

@operationsdotbcs

Would you please share the sample PDF document that you are using to add PageStamp in the final document after conversion?

0684L00000IuBb1QAF.pdf (93.5 KB)

will you give me back the answer here?

@operationsdotbcs

We are afraid that we are still unable to reproduce the scenario using your code snippet and Aspose.PDF. It looks like you did not share the PDF file that you are using to add the stamp. Please check the screenshot of header stamp that is present in the PDF shared in your first post. We requested that you please share that content with us so that we can try to replicate the issue in our environment and address it accordingly. image.png (69.5 KB)

I shared that pdf I will share it again0684L00000IuBb1QAF.pdf (93.5 KB)

@operationsdotbcs

We apologize for the trouble. It is possible that we are not getting it right. As per our understandings, you are generating a PDF from Word document that looks like image.png (It is document number 1). Then you are adding a PageStamp in the Header/Footer of this document and the stamp looks like image.png (It is document number 2).

Now, we need the document number 2 (the template document) that is being used as a stamp and loaded in PageStamp like below:

PdfPageStamp pageStamp = new PdfPageStamp(pdfTemplaeDocument.getPages().get_Item(1));

We again apologize if we are unable to understand the situation. Please feel free to provide any information that can help us in replicating the issue in our environment and address it accordinlgy.