Support for Geospatial PDF in PDFNet SDK

Q:

I am evaluating PDFNet for an application that requires reading and writing geospatial PDF files exploiting Adobe’s geospatial extensions to ISO 32000. Is it possible to read and write this metadata using your PDFNet SDK?

A:

You can use PDFNet SDK to read/write/edit geospatial PDF-s.

The georeferencing metadata for geospatial PDF is most commonly encoded in one of two ways: the OGC best practice and as upcoming extension to ISO 32000 (a.k.a. PDF 2.0).

To get familiar with OGC-s, as a starting point please take a look at PDFLayers sample (http://www.pdftron.com/pdfnet/samplecode.html#PDFLayers).

PDFNet can also be used to read/write/edit upcoming PDF 2.0 geospatial info using SDF/Cos API.

For example, given a ‘pdftron.PDF.Image’ (for example of how to access images see ImageExtract sample project - http://www.pdftron.com/pdfnet/samplecode.html#ImageExtract) you can access geospatial data as follows:

Obj image_dict = image.GetSDFObj();

Obj measure = image_dict .FindObj(“Measure”);

if (measure != null) {

Obj type = measure.FindObj(“Subtype”);

if (type!=null && type.GetName()==“GEO”) {

Obj bounds = measure.FindObj(“Bounds”);

Obj gcs = measure.FindObj(“GCS”); // A projected or geographic coordinate system dictionary.

// A projected or geographic coordinate system that shall be used for the display of position values, such as latitude and longitude.

Obj dcs = measure.FindObj(“DCS”);

Obj pdu = measure.FindObj(“PDU”);

Obj gpts = measure.FindObj(“GPTS”);

Obj lpts = measure.FindObj(“LPTS”);

… process the data …

}

}

Obj pt = image_dict .FindObj(“PtData”);

if (pt != null) {

// Process extended geospatial data from a point data dictionary…

}

For more info on how to get started with SDF/Cos API please see SDFTest sample (http://www.pdftron.com/pdfnet/samplecode.html#SDF) as well as the Getting started tutorial (http://www.pdftron.com/pdfnet/intro.html#sdf_objs).

Q:

This is helpful, thank you. Additional question… how does one test the result. Are there pdf object viewer apps that one can use to debug the pdf? What pdf viewers can view geo data in a pdf?

Can GEO data be put anywhere or must it be associated with an image object or what? How will other pdf readers find it in the object hierarchy?

A:

Acrobat Pro X supports GEO referenced PDFs as well as some basic authoring out of the box. For debugging, you could use CosEdit (http://www.pdftron.com/pdfcosedit/downloads.html).

You can associate GEO data with any image, group/layers… so with any type of PDF content.

On Wednesday, September 5, 2012 4:05:14 PM UTC-7, Support wrote:

Q:

I am evaluating PDFNet for an application that requires reading and writing geospatial PDF files exploiting Adobe’s geospatial extensions to ISO 32000. Is it possible to read and write this metadata using your PDFNet SDK?


A:

You can use PDFNet SDK to read/write/edit geospatial PDF-s.

The georeferencing metadata for geospatial PDF is most commonly encoded in one of two ways: the OGC best practice and as upcoming extension to ISO 32000 (a.k.a. PDF 2.0).

To get familiar with OGC-s, as a starting point please take a look at PDFLayers sample (http://www.pdftron.com/pdfnet/samplecode.html#PDFLayers).

PDFNet can also be used to read/write/edit upcoming PDF 2.0 geospatial info using SDF/Cos API.

For example, given a ‘pdftron.PDF.Image’ (for example of how to access images see ImageExtract sample project - http://www.pdftron.com/pdfnet/samplecode.html#ImageExtract) you can access geospatial data as follows:

Obj image_dict = image.GetSDFObj();

Obj measure = image_dict .FindObj(“Measure”);

if (measure != null) {

Obj type = measure.FindObj(“Subtype”);

if (type!=null && type.GetName()==“GEO”) {

Obj bounds = measure.FindObj(“Bounds”);

Obj gcs = measure.FindObj(“GCS”); // A projected or geographic coordinate system dictionary.

// A projected or geographic coordinate system that shall be used for the display of position values, such as latitude and longitude.

Obj dcs = measure.FindObj(“DCS”);

Obj pdu = measure.FindObj(“PDU”);

Obj gpts = measure.FindObj(“GPTS”);

Obj lpts = measure.FindObj(“LPTS”);

… process the data …

}

}

Obj pt = image_dict .FindObj(“PtData”);

if (pt != null) {

// Process extended geospatial data from a point data dictionary…

}

For more info on how to get started with SDF/Cos API please see SDFTest sample (http://www.pdftron.com/pdfnet/samplecode.html#SDF) as well as the Getting started tutorial (http://www.pdftron.com/pdfnet/intro.html#sdf_objs).