Removing footers

Is it possible to remove footers in a pdf document? I have tried using PdfPageEditor, Generator, and Page, yet nothing seems to allow me to identify and remove a footer from a page.

I know that I could try converting it to a word document but would like to try to avoid that if possible as there are issues with tables being displayed correctly. (see: <a href="https://forum.aspose.com/t/22988)


Thanks!

Hi Charles,


Thanks for contacting support and sorry for the delayed response.

The Header/Footer are added as Stamp object in PDF files and in order to remove the Header/Footer, we need to provide the respective Stamp ID or index number. Please try using either of the following methods to remove Header/Footer from PDF file.

DeleteStamp

[C#]

PdfContentEditor contentEditor = new PdfContentEditor();<o:p></o:p>

contentEditor.BindPdf(“file.pdf”);

contentEditor.DeleteStamp(1, new int[] { 2, 3, 5
});

contentEditor.Save(“outfile.pdf”);
DeleteStampByIds
[C#]

PdfContentEditor contentEditor = new PdfContentEditor();<o:p></o:p>

contentEditor.BindPdf(“file.pdf”);

contentEditor.DeleteStampByIds(1, new int[] { 100, 101
});

contentEditor.Save(“outfile.pdf”);


Please note that when adding stamps to PDF files, appropriate ID’s should be assigned.

[C#]

PdfFileStamp pfe = new
PdfFileStamp(TestSettings.GetInputFile(“PdfWithSeveralPages.pdf”),
TestSettings.GetOutputFile(“34634.pdf”));<o:p></o:p>

//100 is stampId for footer

pfe.StampId = 100;

pfe.AddFooter(new FormattedText("Footer"), 10);

//200 is stampId for header

pfe.StampId = 200;

pfe.AddHeader(new FormattedText("Header"), 10);

//300 if stampId for page number

pfe.StampId = 300;

pfe.AddPageNumber(new FormattedText(" Page #", System.Drawing.Color.Red, System.Drawing.Color.Blue));

pfe.Close();

When I try ‘contentEditor.GetStamps(1)’ it returns an empty list. (see attached sample code)

I assume that is because the input file was not build using stamps/stamp ids. Is there still a way for me to edit the footers if they weren’t built with stamps/stamp ids?

Does Aspose support the recognition of headers and footers in PDFs that were not created with Aspose?

I haven’t found a way to modify them in Aspose.PDF and have noticed that they still aren’t recognized when you try to convert a PDF to a word document.


CWilliams-SBS:
When I try ‘contentEditor.GetStamps(1)’ it returns an empty list. (see attached sample code)

I assume that is because the input file was not build using stamps/stamp ids. Is there still a way for me to edit the footers if they weren’t built with stamps/stamp ids?
Hi Charles,

Thanks for contacting support.

I have tested the scenario using the resource file which you have shared and as per my observations, the stamp count being returned is 0 and also I am unable to remove the stamp using DeleteStampByIds(…) method. For the sake of correction, I have logged this
issue as
PDFNEWNET-35682 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. Please be patient and spare us little time. We are sorry
for this inconvenience.

CWilliams-SBS:
Does Aspose support the recognition of headers and footers in PDFs that were not created with Aspose?

I haven’t found a way to modify them in Aspose.PDF and have noticed that they still aren’t recognized when you try to convert a PDF to a word document.
Hi Charles,

When converting PDF file to DOC/DOCX format, the header/footer are not treated as Header/Footer objects. The problem has already been logged in our issue tracking system as PDFNEWNET-33612. As soon as this issue is resolved, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. We apologize for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-35682) have been fixed in Aspose.Pdf for .NET 8.9.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Charles,


Thanks for your patience. We would like to update you that currently Asopse.PDF does not support recognition/deletion of the stamps added with other than Aspose.PDF API.

We are sorry for the inconvenience caused.

Best Regards,

Hi Charles,

Thanks for your patience.

We have further investigated the issue PDFNEWNET-33612 reported earlier and I am afraid we cannot fix this problem. Unfortunately the ordinary pdf format (without tags) doesn’t contain any information that allows to identify text as а header or а footer.

There is no way to determine whether page contains a header or a footer without additional information (like tags -http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf
9.7 Tagged PDF). For example the first line of text can be a part of header or can be a title of page or a simple text. There is no universal solution for solving this problem.

So we need to discuss the possible workarounds for this problem. You should get additional information (like tags) during conversion of pdf documents. We are sorry for this inconvenience.