I m searching for a way with a free dll library modify a pdf. I want to insert an image to a certain position into a pdf document.
I already found iTextSharp, but this only add a page before my document.
How do I insert an image to specific position?
var reader = new PdfReader(inputPdfStream);
var stamper = new PdfStamper(reader, outputPdfStream);
var pdfContentByte = stamper.GetOverContent(1);
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(inputImageStream);
iTextSharp.text.Rectangle r_01 = new iTextSharp.text.Rectangle(30,10);
PdfContentByte page1 = stamper.GetOverContent(1);
image.SetAbsolutePosition(0,0);
page1.AddImage(image);
stamper.Close();
ITextSharp is a good one, and you can actually add images to existing pages. We use it to auto-generate our product templates and add QR codes.
See Darin Dimitrov's answer here: How can I insert an image with iTextSharp in an existing PDF?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.