/** * Creates a TextMarkup annotation of the specified sub type. * * @param subType the subtype the annotation represents */ protected PDAnnotationTextMarkup(String subType) { setSubtype(subType); // Quad points are required, set an empty array setQuadPoints(new float[0]); }
/** * This will retrieve the set of quadpoints which encompass the areas of this annotation. * * @return An array of floats representing the quad points. */ public float[] getQuadPoints() { COSBase base = getCOSObject().getDictionaryObject(COSName.QUADPOINTS); if (base instanceof COSArray) { return ((COSArray) base).toFloatArray(); } // Should never happen as this is a required item return null; } }
PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup( PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT); txtMark.setColor(blue); txtMark.setConstantOpacity((float)0.2); // 20% transparent position.setUpperRightX(INCH + textWidth); position.setUpperRightY(ph - INCH); txtMark.setRectangle(position); quads[7] = quads[5]; // y5 txtMark.setQuadPoints(quads); txtMark.setContents("Highlighted since it's important"); annotations.add(txtMark);
public FreeTextAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdFreeText = new PDAnnotationTextMarkup(annotDictionary); this.pdAnnot = this.pdFreeText; }
PDDocument doc = PDDocument.load(/*path to the file*/); PDPage page = (PDPage)doc.getDocumentCatalog.getAllPages.get(i); List annots = page.getAnnotations; PDAnnotationTextMarkup markup = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.Su....); markup.setRectangle(/*your PDRectangle*/); markup.setQuads(/*float array of size eight with all the vertices of the PDRectangle in anticlockwise order*/); annots.add(markup); doc.save(/*path to the output file*/);
public MarkupAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdMarkup = new PDAnnotationTextMarkup(annotDictionary); this.pdAnnot = this.pdMarkup; }
PDDocument doc = PDDocument.load(/*path to the file*/); PDPage page = (PDPage)doc.getDocumentCatalog.getAllPages.get(i); List annots = page.getAnnotations; PDAnnotationTextMarkup markup = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.Su....); markup.setRectangle(/*your PDRectangle*/); markup.setQuads(/*float array of size eight with all the vertices of the PDRectangle in anticlockwise order*/); annots.add(markup); doc.save(/*path to the output file*/);
public MarkupAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdMarkup = new PDAnnotationTextMarkup(annotDictionary); this.pdAnnot = this.pdMarkup; }
/** * Creates a TextMarkup annotation of the specified sub type. * * @param subType the subtype the annotation represents */ public PDAnnotationTextMarkup(String subType) { setSubtype(subType); // Quad points are required, set and empty array setQuadPoints(new float[0]); }
/** * This will set the set of quadpoints which encompass the areas of this annotation. * * @param quadPoints an array representing the set of area covered */ public final void setQuadPoints(float[] quadPoints) { COSArray newQuadPoints = new COSArray(); newQuadPoints.setFloatArray(quadPoints); getCOSObject().setItem(COSName.QUADPOINTS, newQuadPoints); }
public FreeTextAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdFreeText = new PDAnnotationTextMarkup(annotDictionary); this.pdAnnot = this.pdFreeText; }
/** * Creates a TextMarkup annotation of the specified sub type. * * @param subType the subtype the annotation represents */ public PDAnnotationTextMarkup(String subType) { setSubtype(subType); // Quad points are required, set and empty array setQuadPoints(new float[0]); }
/** * This will set the sub type (and hence appearance, AP taking precedence) For this annotation. See the SUB_TYPE_XXX * constants for valid values. * * @param subType The subtype of the annotation */ public final void setSubtype(String subType) { getCOSObject().setName(COSName.SUBTYPE, subType); }
annot = new PDAnnotationTextMarkup(annotDic);
/** * This will set the sub type (and hence appearance, AP taking precedence) For this annotation. See the SUB_TYPE_XXX * constants for valid values. * * @param subType The subtype of the annotation */ public void setSubtype(String subType) { getCOSObject().setName(COSName.SUBTYPE, subType); }
annot = new PDAnnotationTextMarkup(annotDic);
/** * This will retrieve the sub type (and hence appearance, AP taking precedence) For this annotation. * * @return The subtype of this annotation, see the SUB_TYPE_XXX constants. */ public String getSubtype() { return getCOSObject().getNameAsString(COSName.SUBTYPE); }
/** * This will retrieve the sub type (and hence appearance, AP taking precedence) For this annotation. * * @return The subtype of this annotation, see the SUB_TYPE_XXX constants. */ @Override public String getSubtype() { return getCOSObject().getNameAsString(COSName.SUBTYPE); }
/** * This will retrieve the set of quadpoints which encompass the areas of this annotation. * * @return An array of floats representing the quad points. */ public float[] getQuadPoints() { COSBase base = getCOSObject().getDictionaryObject(COSName.QUADPOINTS); if (base instanceof COSArray) { return ((COSArray) base).toFloatArray(); } // Should never happen as this is a required item return null; }
/** * This will retrieve the set of quadpoints which encompass the areas of this annotation. * * @return An array of floats representing the quad points. */ public float[] getQuadPoints() { COSArray quadPoints = (COSArray) getCOSObject().getDictionaryObject(COSName.QUADPOINTS); if (quadPoints != null) { return quadPoints.toFloatArray(); } else { return null; // Should never happen as this is a required item } }