0

Using ASP.NET, is it possible to get the title for each page from a multipage pdf document?

Thanks for any help!

WhatsInAName
  • 724
  • 2
  • 12
  • 32
  • I suspect that you are not looking for the Title of the PDF document, which is a document property, but for the title that appears visually at the top of each page. Can you elaborate? – Frank Rem Aug 24 '12 at 07:20
  • You are correct. Our company wants to build a web application for the mobile devices (currently iPad) so they don't have to invest on native device specific applications targeted for each device. Since mobile devices support web applications built in Html5, I am writing a web application using Html5. The user of this application needs to select a pdf file (multipage) from a list of pdfs and ideally the page titles will appear on the left of the page as a table of content sort of thingy. When clicked, those links will display the corresponding pages from the main pdf. Is this even possible? – WhatsInAName Aug 24 '12 at 22:22

1 Answers1

0

To read metadata with iTextSharp:

You can read metadata using PdfReader.

PdfReader reader = new PdfReader("SomeFile.pdf");
string s = reader.Info["Author"];

To Write metadata during rendering/saving output:

http://milan.kupcevic.net/ghostscript-ps-pdf/

  /Title (Document title)
  /Author (Author name)
  /Subject (Subject description)
  /Keywords (comma, separated, keywords)
  /ModDate (D:20061204092842)
  /CreationDate (D:20061204092842)
  /Creator (application name or creator note)
  /Producer (PDF producer name or note)
  /DOCINFO pdfmark
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
  • No, I am not using ghostscript but can convince my supervisor to buy it if it can achieve what we are looking for. Is there a demo or something that I can look at? – WhatsInAName Aug 24 '12 at 00:02
  • @WhatsInAName ghostscript uses the AGPL license, so you should be able to test it as much as you want for free. You may have to pay for the commercial license to deploy it however. Note I get: `Error: /undefined in Title` running `Title ==`. –  Mar 28 '14 at 20:37
  • I think this script is for writing the meta information not reading it. –  Mar 31 '14 at 13:18
  • @ebyrob maybe iTextSharp is more applicable? http://stackoverflow.com/questions/2761646/read-modify-pdf-metadata-using-itextsharp – FlavorScape Mar 31 '14 at 16:12
  • @FlavorScape I don't think iTextSharp renders? In any case, are you agreeing the code you posted can only **write** when the question was for something that can **read**? –  Mar 31 '14 at 17:56