public SquareCircleAnnotationValidator(PreflightContext ctx, PDAnnotationSquareCircle annotation) { super(ctx, annotation.getCOSObject()); this.pdSquareCircle = annotation; this.pdAnnot = this.pdSquareCircle; }
/** * Return true if the IC field is present in the Annotation dictionary and if the RGB profile is used in the * DestOutputProfile of the OutputIntent dictionary. * * @return the validation state of the IC field. */ protected boolean checkIColors() throws ValidationException { if (this.pdSquareCircle.getInteriorColor() != null && !searchRGBProfile()) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_COLOR, "Annotation uses a Color profile which isn't the same than the profile contained by the OutputIntent")); return false; } return true; }
/** * This will retrieve the interior color of the drawn area color is in DeviceRGB color space. * * @return object representing the color. */ public PDColor getInteriorColor() { return getColor(COSName.IC); }
PDRectangle handleBorderBox(PDAnnotationSquareCircle annotation, float lineWidth) { // There are two options. The handling is not part of the PDF specification but // implementation specific to Adobe Reader // - if /RD is set the border box is the /Rect entry inset by the respective // border difference. // - if /RD is not set the border box is defined by the /Rect entry. The /RD entry will // be set to be the line width and the /Rect is enlarged by the /RD amount PDRectangle borderBox; float[] rectDifferences = annotation.getRectDifferences(); if (rectDifferences.length == 0) { borderBox = getPaddedRectangle(getRectangle(), lineWidth / 2); // the differences rectangle annotation.setRectDifferences(lineWidth / 2); annotation.setRectangle(addRectDifferences(getRectangle(), annotation.getRectDifferences())); // when the normal appearance stream was generated BBox and Matrix have been set to the // values of the original /Rect. As the /Rect was changed that needs to be adjusted too. annotation.getNormalAppearanceStream().setBBox(getRectangle()); AffineTransform transform = AffineTransform.getTranslateInstance(-getRectangle().getLowerLeftX(), -getRectangle().getLowerLeftY()); annotation.getNormalAppearanceStream().setMatrix(transform); } else { borderBox = applyRectDifferences(getRectangle(), rectDifferences); borderBox = getPaddedRectangle(borderBox, lineWidth / 2); } return borderBox; } }
PDAnnotationSquareCircle aCircle = new PDAnnotationSquareCircle( PDAnnotationSquareCircle.SUB_TYPE_CIRCLE); aCircle.setContents("Circle Annotation"); aCircle.setInteriorColor(red); // Fill in circle in red aCircle.setColor(blue); // The border itself will be blue aCircle.setBorderStyle(borderThin); position.setUpperRightX(2 * INCH); // 1" in, 1" width position.setUpperRightY(ph - 3*INCH); // 3" down aCircle.setRectangle(position); annotations.add(aCircle); PDAnnotationSquareCircle aSquare = new PDAnnotationSquareCircle( PDAnnotationSquareCircle.SUB_TYPE_SQUARE); aSquare.setContents("Square Annotation"); aSquare.setColor(red); // Outline in red, not setting a fill aSquare.setBorderStyle(borderThick); aSquare.setRectangle(position); annotations.add(aSquare);
public SquareCircleAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdSquareCircle = new PDAnnotationSquareCircle(annotDictionary); this.pdAnnot = this.pdSquareCircle; }
contentStream.setStrokingColorOnDemand(getColor()); boolean hasBackground = contentStream .setNonStrokingColorOnDemand(((PDAnnotationSquareCircle) getAnnotation()).getInteriorColor()); handleOpacity(((PDAnnotationSquareCircle) getAnnotation()).getConstantOpacity()); contentStream.setBorderLine(lineWidth, ((PDAnnotationSquareCircle) getAnnotation()).getBorderStyle());
/** * Creates a Circle or Square annotation of the specified sub type. * * @param subType the subtype the annotation represents. */ protected PDAnnotationSquareCircle(String subType) { setSubtype(subType); }
public SquareCircleAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary) { super(ctx, annotDictionary); this.pdSquareCircle = new PDAnnotationSquareCircle(annotDictionary); this.pdAnnot = this.pdSquareCircle; }
contentStream.setStrokingColorOnDemand(getColor()); boolean hasBackground = contentStream .setNonStrokingColorOnDemand(((PDAnnotationSquareCircle) getAnnotation()).getInteriorColor()); handleOpacity(((PDAnnotationSquareCircle) getAnnotation()).getConstantOpacity()); contentStream.setBorderLine(lineWidth, ((PDAnnotationSquareCircle) getAnnotation()).getBorderStyle());
/** * Creates a Circle or Square annotation of the specified sub type. * * @param subType the subtype the annotation represents. */ public PDAnnotationSquareCircle(String subType) { setSubtype(subType); }
/** * This will set the rectangle difference rectangle. Giving the difference between the * annotations rectangle and where the drawing occurs. (To take account of any effects applied * through the BE entry for example) * * @param rd the rectangle difference * */ public void setRectDifference(PDRectangle rd) { getCOSObject().setItem(COSName.RD, rd); }
|| PDAnnotationSquareCircle.SUB_TYPE_CIRCLE.equals(subtype)) annot = new PDAnnotationSquareCircle(annotDic);
/** * Return true if the IC field is present in the Annotation dictionary and if the RGB profile is used in the * DestOutputProfile of the OutputIntent dictionary. * * @return the validation state of the IC field. */ protected boolean checkIColors() throws ValidationException { if (this.pdSquareCircle.getInteriorColor() != null && !searchRGBProfile()) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_COLOR, "Annotation uses a Color profile which isn't the same than the profile contained by the OutputIntent")); return false; } return true; }
/** * This will retrieve the interior color of the drawn area color is in DeviceRGB color space. * * @return object representing the color. */ public PDColor getInteriorColor() { return getColor(COSName.IC); }
/** * Creates a Circle or Square annotation of the specified sub type. * * @param subType the subtype the annotation represents. */ public PDAnnotationSquareCircle(String subType) { setSubtype(subType); }
/** * This will set the border effect dictionary, specifying effects to be applied when drawing the * line. This is supported by PDF 1.5 and higher. * * @param be The border effect dictionary to set. * */ public void setBorderEffect(PDBorderEffectDictionary be) { getCOSObject().setItem(COSName.BE, be); }
|| PDAnnotationSquareCircle.SUB_TYPE_CIRCLE.equals(subtype)) annot = new PDAnnotationSquareCircle(annotDic);
/** * Return true if the IC field is present in the Annotation dictionary and if the RGB profile is used in the * DestOutputProfile of the OutputIntent dictionary. * * @return the validation state of the IC field. */ protected boolean checkIColors() throws ValidationException { if (this.pdSquareCircle.getInteriorColor() != null && !searchRGBProfile()) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_COLOR, "Annotation uses a Color profile which isn't the same than the profile contained by the OutputIntent")); return false; } return true; }
/** * This will retrieve the interior color of the drawn area color is in DeviceRGB color space. * * @return object representing the color. */ public PDColor getInteriorColor() { return getColor(COSName.IC); }