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?
Asked
Active
Viewed 1,945 times
0
-
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
-
1On, 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 Answers
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:
- just create an
Image
object and dodocument.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) - if you really want the 'current position' in the
document.add()
sequence use theGetVerticalPosition()
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