0

I'm having a requirement where I want to insert an image at the current cursor position of the PDF document. Will it be possible using itextSharp library? If yes, please tell me which interfaces I can use to achieve this?

  • possible duplicate of [How can I insert an image with iTextSharp in an existing PDF?](http://stackoverflow.com/questions/583629/how-can-i-insert-an-image-with-itextsharp-in-an-existing-pdf) – Lucas Trzesniewski Mar 05 '15 at 11:36
  • 1
    On, and there's no *"cursor"* in a PDF document by the way. Maybe your library maintains one for document construction simplicity, but that's all. – Lucas Trzesniewski Mar 05 '15 at 11:37

1 Answers1

0

The question isn't clear.

A. If you are creating a document from scratch, you could be using...

[1.] a sequence of document.add() calls in which you add elements such as Paragraph, PdfPTable,...

In that case:

  1. just create an Image object and do document.Add(image); in which case, the image will be added. However, not that you may want to change the image sequence default: Image not sequentialy added in pdf document itextsharp (wrong order of elements)
  2. if you really want the 'current position' in the document.add() sequence use the GetVerticalPosition() method as described here: How to find current (X, Y) position in iTextSharp?

[2.] methods to add objects at absolute positions. In that case, there isn't really a cursor.

B. If you are talking about adding content to an existing document, there is no cursor. PDF is just a bunch of characters and lines drawn at absolute positions on a page.

Community
  • 1
  • 1
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165