Q: I am wondering if PDFNet SDK provides a way to get the coordinates of the objects in a PDF file.
Actually, we plan to develop a function to insert a custom figure into a PDF file at a specific point. We tried PDFSharp, an open source library, however, it is not relaible and doesn’t provide functions to retrieve the coordinates.
A: Using PDFNet SDK you can perform content extraction and editing on any PDF.
I am not exactly sure what type of information you are looking for but as a starting point you may want to take a look at the following two projects:
ElementReader & ElementReaderAdv:
http://www.pdftron.com/pdfnet/samplecode.html#ElementReaderAdv
specifically you would use element.GetBBox() to obtain the bounding box for any graphical element on the page.
In case you are looking for something a bit higher-level, please see TextExtract sample project:
http://www.pdftron.com/pdfnet/samplecode.html#TextExtract
With ‘pdftron.PDF.TextExtractor’ you can obtain the positioning information for any character, word, line, paragraph, etc (e.g. word.GetBBox() etc).
In case you need to edit an existing PDF page a good starting point would be to take a look at ElementEdit sample:
ElementEdit: http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit
If you only need to stamp/watermark existing PDF pages you could use ‘pdftron.PDF.Stamper’ utility without using ElementBuilder/Writer:
PDF Stamper: http://www.pdftron.com/pdfnet/samplecode.html#Stamper