use of com.tom_roush.pdfbox.pdmodel.interactive.measurement.PDViewportDictionary in project PdfBox-Android by TomRoush.
the class PDPage method getViewports.
/**
* Get the viewports.
*
* @return a list of viewports or null if there is no /VP entry.
*/
public List<PDViewportDictionary> getViewports() {
COSBase base = page.getDictionaryObject(COSName.VP);
if (!(base instanceof COSArray)) {
return null;
}
COSArray array = (COSArray) base;
List<PDViewportDictionary> viewports = new ArrayList<PDViewportDictionary>();
for (int i = 0; i < array.size(); ++i) {
COSBase base2 = array.getObject(i);
if (base2 instanceof COSDictionary) {
viewports.add(new PDViewportDictionary((COSDictionary) base2));
} else {
Log.w("PdfBox-Android", "Array element " + base2 + " is skipped, must be a (viewport) dictionary");
}
}
return viewports;
}
use of com.tom_roush.pdfbox.pdmodel.interactive.measurement.PDViewportDictionary in project PdfBox-Android by TomRoush.
the class PDPage method setViewports.
/**
* Set the viewports.
*
* @param viewports A list of viewports, or null if the entry is to be deleted.
*/
public void setViewports(List<PDViewportDictionary> viewports) {
if (viewports == null) {
page.removeItem(COSName.VP);
return;
}
COSArray array = new COSArray();
for (PDViewportDictionary viewport : viewports) {
array.add(viewport);
}
page.setItem(COSName.VP, array);
}
Aggregations