I'm trying to use iTextSharp for mobile application.
So i'm creating pdf files and append this pdf with image,where absolution position is Height/Width of image!
So now,i need to add images(for each image i should use new page)into my existing pdf file,also i would like to know how to extract this images from my PDF file!
At current moment i tried to add image via stamper:
using (System.IO.Stream inputPdfStream = new FileStream(PathOfPdf, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (System.IO.Stream inputImageStream = new FileStream(PathOfImage, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (System.IO.Stream outputPdfStream = new FileStream(PathOfPdf.Substring(0, PathOfPdf.Length - 4) + "T.pdf", FileMode.Create, FileAccess.Write, FileShare.None))
{
var reader = new PdfReader(inputPdfStream);
var stamper = new PdfStamper(reader, outputPdfStream);
var pdfContentByte = stamper.GetOverContent(1);
Image image = Image.GetInstance(inputImageStream);
image.SetAbsolutePosition(image.Width, image.Height);
pdfContentByte.AddImage(image);
stamper.Close();
}
}
}
And the problem is that new image just overlaying first page of pdf and save it!
Why that happens ? Also,how i can extract this images from pdf file!?
Thanks!!