ITsolutionWizard
asked on
c#, pdf
I have below codes working fine.
but instead of drop the image into the fixed location ( image.SetAbsolutePosition( 100, 100);)
Is it possible to do the look up e.g. if the text called 'signature' is shown on the pdf, then drop the image there on the right side of the 'signature' text?
Or if there is any textbox field called 'signature', drop the image next to it.
Is it possible?
0c8f5c99-4ff8-4863-bb62-3af10ad394a8.pdf
but instead of drop the image into the fixed location ( image.SetAbsolutePosition(
Is it possible to do the look up e.g. if the text called 'signature' is shown on the pdf, then drop the image there on the right side of the 'signature' text?
Or if there is any textbox field called 'signature', drop the image next to it.
Is it possible?
0c8f5c99-4ff8-4863-bb62-3af10ad394a8.pdf
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
class Program
{
static void Main(string[] args)
{
using (Stream inputPdfStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream inputImageStream = new FileStream("some_image.jpg", FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream outputPdfStream = new FileStream("result.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(100, 100);
pdfContentByte.AddImage(image);
stamper.Close();
}
}
}
ASKER
any helps?
ASKER
any helps?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i import pdf shape library, and run your codes. it is not working at al..
need more info as that function is from an active app.
is it returning 0,0,0,0 as rectangle, as that is the flag for not finding the formfield.
is it returning 0,0,0,0 as rectangle, as that is the flag for not finding the formfield.
ASKER