0

I want to be able to add a 'Page x of y' footer with iTextSharp that can then be updated and manipulated using the Header & Footer options in Adobe Acrobat. After the pdf is generated, users may still manually add or remove some pages, so I want them to be able to update the footer easily.

I've found quite a few resources showing how to add some text as a header or footer using PageEvent and GetOverContent(). However, once the pdf is generated, these are just plain text and aren't actually a header or footer object that can be updated in Acrobat without changing the text on each one.

Anyone know how to either:

  • a) access an existing pdf's header/footer objects via iTextSharp, or
  • b) create an actual header/footer object that Acrobat can manipulate

I'm using v5.4.3.0 - thank you

Brett
  • 1,267
  • 1
  • 13
  • 21

1 Answers1

0

I won't downvote the question, but IMHO it's not an eligible question for StackOverflow. You may expect counter-questions such as "what have you tried."

As I'm the original developer of iText, let me explain why your question isn't a support question, but rather a request for consultancy.

PDF is defined in an ISO standard, ISO-32000-1. This standard is implemented by many companies, Adobe being the original creator of the spec, is one of them, iText Software is another.

You're asking for functionality that isn't part of the spec. You're asking about a specific implementation that is proprietary to Adobe. When using the Header & Footer functionality, Acrobat creates an Artifact (/Artifact <</Type /Pagination /Contents (Test) /Subtype /Header >>) and it stores the content stream of this artifact in a way that isn't part of the standard. (I've just read the draft for ISO-32000-2, the specification for PDF 2.0 we'll discuss at the meeting of the ISO committee in a couple of weeks, and I didn't encounter it.)

If you'd want to mimic this behavior using iTextSharp, you'll have to guess the procedure used by Adobe and implement it in iTextSharp (assuming that you're allowed to reverse engineer that procedure; I think it would be legal as it would improve interoperability). I'm pretty sure this is the closest answer to your question you'll get on this forum. It's now up to you to decide: will I implement this myself, or will I hire somebody to do this?

If you want to hire somebody at iText, please note that you'll need a license for your use of iText 5.4.3 before we'll consider your request.

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165