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

Free Support Forum - aspose.com

Remove images- header- footer- page number during PDF converstion to HTML

I am using Aspose.Net.PDF(Ver 9.5) trial version. Is it possible to remove images, header, footer, page number during PDF converstion to HTML?

Hi Mary,

Thanks for contacting support.

You can easily remove images from PDF file using instructions specified over, Delete Images from the PDF File

However in order to remove page number information, you can search for particular string pattern (page number stamp formatting) using Regular Expression and replace the contents with blank characters. For further information, please visit Replace Text Based on a Regular Expression

Now concerning to requirement of removing Header/Footer from PDF file, in order to fulfill this requirement, PdfFileStamp.StampId property was added. This property allows to set identifier of newly created stamp (including header, footer, page number). Added stamp may be removed by PdfContentEditor i.e. we add header, footer and page number giving them arbitrary IDs, and later remove them.


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

//100 is stampId for footer<o:p></o:p>

pfe.StampId = 100;<o:p></o:p>

pfe.AddFooter(new FormattedText(“Footer”), 10);<o:p></o:p>

//200 is stampId for header<o:p></o:p>

pfe.StampId = 200;<o:p></o:p>

pfe.AddHeader(new FormattedText(“Header”), 10);<o:p></o:p>

//300 if stampId for page number<o:p></o:p>

pfe.StampId = 300;<o:p></o:p>

pfe.AddPageNumber(new FormattedText(" Page #", System.Drawing.Color.Red, System.Drawing.Color.Blue));<o:p></o:p>


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


StampInfo[] stamps = pce.GetStamps(1);<o:p></o:p>


Assert.AreEqual(3, stamps.Length);<o:p></o:p>

//show found stamps IDs<o:p></o:p>

foreach (StampInfo info in stamps)<o:p></o:p>

{ Console.WriteLine(info.StampId); }<o:p></o:p>

//remove header, footer and page number<o:p></o:p>





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