Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

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?

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);

Open in new window

Avatar of ITsolutionWizard
Flag of United States of America image


any helps?
any helps?
any helps?
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.