本文整理汇总了Java中org.apache.pdfbox.cos.COSArray.size方法的典型用法代码示例。如果您正苦于以下问题:Java COSArray.size方法的具体用法?Java COSArray.size怎么用?Java COSArray.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pdfbox.cos.COSArray
的用法示例。
在下文中一共展示了COSArray.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.apache.pdfbox.cos.COSArray; //导入方法依赖的package包/类
/**
* Validates the PDF file specified in the constructor
* @return PDFDocumentInfo structure
**/
public PDFDocumentInfo validate() throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException {
String infoString = null;
PDDocument document = null;
try {
document = PDDocument.load(new File(path));
COSDictionary trailer = document.getDocument().getTrailer();
COSDictionary root = (COSDictionary) trailer.getDictionaryObject(COSName.ROOT);
COSDictionary acroForm = (COSDictionary) root.getDictionaryObject(COSName.ACRO_FORM);
if (acroForm == null) {
return doc;
}
COSArray fields = (COSArray) acroForm.getDictionaryObject(COSName.FIELDS);
for (int i = 0; i < fields.size(); i ++) {
COSDictionary field = (COSDictionary) fields.getObject(i);
COSName type = field.getCOSName(COSName.FT);
if (COSName.SIG.equals(type)) {
COSDictionary sig = (COSDictionary) field.getDictionaryObject(COSName.V);
if (sig != null) {
getSignatureInfo(sig);
}
}
}
}
finally {
if (document != null) {
document.close();
}
}
return doc;
}
示例2: process
import org.apache.pdfbox.cos.COSArray; //导入方法依赖的package包/类
/**
* TJ Show text, allowing individual glyph positioning.
* @param operator The operator that is being executed.
* @param arguments List
* @throws IOException If there is an error processing this operator.
*/
public void process(PDFOperator operator, List arguments) throws IOException
{
((PDFObjectExtractor)context).setNewTextFragment(true);
COSArray array = (COSArray)arguments.get( 0 );
float adjustment=0;
for( int i=0; i<array.size(); i++ )
{
COSBase next = array.get( i );
if( next instanceof COSNumber )
{
adjustment = ((COSNumber)next).floatValue();
Matrix adjMatrix = new Matrix();
adjustment=(-adjustment/1000)*context.getGraphicsState().getTextState().getFontSize() *
(context.getGraphicsState().getTextState().getHorizontalScalingPercent()/100);
adjMatrix.setValue( 2, 0, adjustment );
context.setTextMatrix( adjMatrix.multiply( context.getTextMatrix() ) );
}
else if( next instanceof COSString )
{
// TEST 27.08.09
// ((PDFObjectExtractor)context).setNewTextFragment(true);
((PDFObjectExtractor)context).showString( ((COSString)next).getBytes() , i);
//((PDFObjectExtractor)context).setNewTextFragment(false);
// automatically set in addCharacter method (simplest way possible)
}
else
{
throw new IOException( "Unknown type in array for TJ operation:" + next );
}
}
}