use of org.apache.pdfbox.cos.COSNumber in project pdfbox by apache.
the class PDType3CharProc method getGlyphBBox.
/**
* Calculate the bounding box of this glyph. This will work only if the first operator in the
* stream is d1.
*
* @return the bounding box of this glyph, or null if the first operator is not d1.
* @throws IOException If an io error occurs while parsing the stream.
*/
public PDRectangle getGlyphBBox() throws IOException {
List<COSBase> arguments = new ArrayList<>();
PDFStreamParser parser = new PDFStreamParser(this);
Object token = parser.parseNextToken();
while (token != null) {
if (token instanceof COSObject) {
arguments.add(((COSObject) token).getObject());
} else if (token instanceof Operator) {
if (((Operator) token).getName().equals("d1") && arguments.size() == 6) {
for (int i = 0; i < 6; ++i) {
if (!(arguments.get(i) instanceof COSNumber)) {
return null;
}
}
return new PDRectangle(((COSNumber) arguments.get(2)).floatValue(), ((COSNumber) arguments.get(3)).floatValue(), ((COSNumber) arguments.get(4)).floatValue() - ((COSNumber) arguments.get(2)).floatValue(), ((COSNumber) arguments.get(5)).floatValue() - ((COSNumber) arguments.get(3)).floatValue());
} else {
return null;
}
} else {
arguments.add((COSBase) token);
}
token = parser.parseNextToken();
}
return null;
}
use of org.apache.pdfbox.cos.COSNumber in project pdfbox by apache.
the class FDFField method getClearFieldFlags.
/**
* This will get the ClrFf entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The field flags.
*/
public Integer getClearFieldFlags() {
Integer retval = null;
COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.CLR_FF);
if (ff != null) {
retval = ff.intValue();
}
return retval;
}
use of org.apache.pdfbox.cos.COSNumber in project pdfbox by apache.
the class FDFField method getSetFieldFlags.
/**
* This will get the SetFf entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The field flags.
*/
public Integer getSetFieldFlags() {
Integer retval = null;
COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.SET_FF);
if (ff != null) {
retval = ff.intValue();
}
return retval;
}
use of org.apache.pdfbox.cos.COSNumber in project pdfbox by apache.
the class FDFField method getFieldFlags.
/**
* This will get the Ff entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The field flags.
*/
public Integer getFieldFlags() {
Integer retval = null;
COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.FF);
if (ff != null) {
retval = ff.intValue();
}
return retval;
}
use of org.apache.pdfbox.cos.COSNumber in project pdfbox by apache.
the class FDFField method getClearWidgetFieldFlags.
/**
* This will get the ClrF entry of the cos dictionary. If it it not present then this method will return null.
*
* @return The widget field flags.
*/
public Integer getClearWidgetFieldFlags() {
Integer retval = null;
COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.CLR_F);
if (ff != null) {
retval = ff.intValue();
}
return retval;
}
Aggregations