This post is in response to a comment here. Let’s say you have a PDF with hyperlinks pointing to URLs like http://www.bing.com and you want to make these instead point to a page internal to the PDF. (Personally I can’t think of why this would be needed but someone apparently…
Month: January 2012
How to recompress images in a PDF using iTextSharp
(I originally posted this on Stack Overflow) iText and iTextSharp have some methods for replacing indirect objects. Specifically there’s PdfReader.KillIndirect() which does what it says and PdfWriter.AddDirectImageSimple(iTextSharp.text.Image, PRIndirectReference) which you can then use to replace what you killed off. In pseudo C# code you’d do: Below is a full working…