/** * @see javax.swing.table.TableModel#getRowCount() */ public int getRowCount() { return array.size() + 1; }
/** * Gets the number of {@link PdfAnnotation} associated with this page. * * @return the {@code int} number of {@link PdfAnnotation} associated with this page. */ public int getAnnotsSize() { PdfArray annots = getAnnots(false); if (annots == null) return 0; return annots.size(); }
public DeviceN(PdfArray pdfObject) { super(pdfObject); numOfComponents = pdfObject.getAsArray(1).size(); }
private void addRow(PdfObject value) { addRow(array.size(), value); } }
private static void appendSyntaxString(PdfArray array) { stringBuilder.append("[ "); for (int i = 0; i < array.size(); ++i) { safeAppendSyntaxString(array.get(i, false)); stringBuilder.append(" "); } stringBuilder.append("]"); }
private void markArrayContentToFlush(PdfArray array) { for (int i = 0; i < array.size(); i++) { markObjectToFlush(array.get(i, false)); } }
/** * @see javax.swing.table.TableModel#getValueAt(int, int) */ public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return rowIndex == array.size() ? tempValue : PdfSyntaxUtils.getSyntaxString(array.get(rowIndex, false)); default: return null; } }
public int getOutputSize() { PdfArray range = ((PdfDictionary)getPdfObject()).getAsArray(PdfName.Range); return range == null ? 0 : range.size() / 2; }
public int getNumberOfUserProperties() { return getPdfObject().getAsArray(PdfName.P).size(); } }
public int getInputSize() { return ((PdfDictionary)getPdfObject()).getAsArray(PdfName.Domain).size() / 2; }
private static int removeObjectFromArray(PdfArray array, PdfObject toRemove) { int i; for (i = 0; i < array.size(); ++i) { PdfObject obj = array.get(i); if (obj == toRemove || obj == toRemove.getIndirectReference()) { array.remove(i); break; } } return i; } }
/** * Constructs a new PdfVisibilityExpression instance by its raw PdfArray. * @param visibilityExpressionArray the array representing the visibility expression */ public PdfVisibilityExpression(PdfArray visibilityExpressionArray) { super(visibilityExpressionArray); PdfName operator = visibilityExpressionArray.getAsName(0); if (visibilityExpressionArray.size() < 1 || !PdfName.Or.equals(operator) && !PdfName.And.equals(operator) && !PdfName.Not.equals(operator)) { throw new IllegalArgumentException("Invalid visibilityExpressionArray"); } }
private boolean isEqualSameNameDestExist(Map<PdfPage, PdfPage> page2page, PdfDocument toDocument, String srcDestName, PdfArray srcDestArray, PdfPage oldPage) { PdfArray sameNameDest = (PdfArray) toDocument.getCatalog().getNameTree(PdfName.Dests).getNames().get(srcDestName); boolean equalSameNameDestExists = false; if (sameNameDest != null && sameNameDest.getAsDictionary(0) != null) { PdfIndirectReference existingDestPageRef = sameNameDest.getAsDictionary(0).getIndirectReference(); PdfIndirectReference newDestPageRef = page2page.get(oldPage).getPdfObject().getIndirectReference(); if (equalSameNameDestExists = existingDestPageRef.equals(newDestPageRef) && sameNameDest.size() == srcDestArray.size()) { for (int i = 1; i < sameNameDest.size(); ++i) { equalSameNameDestExists = equalSameNameDestExists && sameNameDest.get(i).equals(srcDestArray.get(i)); } } } return equalSameNameDestExists; }
private PdfDictionary getPdfAOutputIntent(PdfArray outputIntents) { for (int i = 0; i < outputIntents.size(); ++i) { PdfName outputIntentSubtype = outputIntents.getAsDictionary(i).getAsName(PdfName.S); if (PdfName.GTS_PDFA1.equals(outputIntentSubtype)) { return outputIntents.getAsDictionary(i); } } return null; }
private void serArray(PdfArray array, ByteBuffer bb, int level, Map<PdfIndirectReference, byte[]> serializedCache) throws SelfReferenceException { bb.append("$A"); if (level <= 0) return; for (int k = 0; k < array.size(); ++k) { serObject(array.get(k, false), bb, level, serializedCache); } bb.append("$\\A"); }
private PdfDictionary getPdfAOutputIntent(PdfArray outputIntents) { for (int i = 0; i < outputIntents.size(); ++i) { PdfName outputIntentSubtype = outputIntents.getAsDictionary(i).getAsName(PdfName.S); if (PdfName.GTS_PDFA1.equals(outputIntentSubtype)) { return outputIntents.getAsDictionary(i); } } return null; }
private void checkAnnotations(PdfDictionary page) { PdfArray annots = page.getAsArray(PdfName.Annots); if (annots != null) { for (int i = 0; i < annots.size(); i++) { PdfDictionary annot = annots.getAsDictionary(i); checkAnnotation(annot); PdfDictionary action = annot.getAsDictionary(PdfName.A); if (action != null) { checkAction(action); } } } }
private void checkAnnotations(PdfDictionary page) { PdfArray annots = page.getAsArray(PdfName.Annots); if (annots != null) { for (int i = 0; i < annots.size(); i++) { PdfDictionary annot = annots.getAsDictionary(i); checkAnnotation(annot); PdfDictionary action = annot.getAsDictionary(PdfName.A); if (action != null) { checkAction(action); } } } }
private void flushResourcesContentStreams() { flushResourcesContentStreams(getResources().getPdfObject()); PdfArray annots = getAnnots(false); if (annots != null) { for (int i = 0; i < annots.size(); ++i) { PdfDictionary apDict = annots.getAsDictionary(i).getAsDictionary(PdfName.AP); if (apDict != null) { flushAppearanceStreams(apDict); } } } }
/** * PDF 2.0. Gets halftone origin * * @return an array of two values specifying X and Y values of the halftone origin in the current coordinate system, * respectively, or <code>null</code> if halftone origin is not specified */ public float[] getHalftoneOrigin() { PdfArray hto = getPdfObject().getAsArray(PdfName.HTO); if (hto != null && hto.size() == 2 && hto.get(0).isNumber() && hto.get(1).isNumber()) { return new float[]{hto.getAsNumber(0).floatValue(), hto.getAsNumber(1).floatValue()}; } else { return null; } }