Q: I have a PDF Form with an OPI Comment inside. The internal
structure is as follows:
/OPI
<<
/1.3
<<
/Type /OPI /Version 1.3 /F << /Type /Filespec /F (/C/
Test/Hi-Res/001-A90841 ROM.eps) >>
/CropRect [0 0 673 872]
/Size [673 872]
/Position [0 0 0 872 673 872 673 0]
>>
>>
I want to change the OPI path only (/C/Test/Hi-Res/001-A90841 ROM.eps)
to E:\test.eps.
How can I achieve this using PDFNet SDK (http://www.pdftron.com/
pdfnet)?
----------------
A: You could use the following Java pseudo-code as a starting point:
if (element.getType() == Element.e_form) {
Obj opi= element.getXObject().findObj("Type");
if (opi != null && opi.isName() && opi.getName().equals("OPI")) {
Obj f = opi.findObj("F");
if (f != null) {
Obj path = f.findObj("F");
if (path != null && path.isString()) {
System.out.println(path.getAsPDFText());
// Set new path
path.setString("/C/Test/my.eps");
}
}
}
}
}