@Override void constructAppearances() throws IOException { PDAnnotationWidget widget = this.getWidgets().get(0); if (widget != null) { // check if the signature is visible if (widget.getRectangle() == null || Float.compare(widget.getRectangle().getHeight(), 0) == 0 && Float.compare(widget.getRectangle().getWidth(), 0) == 0 || widget.isNoView() || widget.isHidden()) { return; } // TODO: implement appearance generation for signatures LOG.warn("Appearance generation for signature fields not yet implemented - you need to generate/update that manually"); } } }
/** * Resolve the bounding box. * * @param fieldWidget the annotation widget. * @param appearanceStream the annotations appearance stream. * @return the resolved boundingBox. */ private PDRectangle resolveBoundingBox(PDAnnotationWidget fieldWidget, PDAppearanceStream appearanceStream) { PDRectangle boundingBox = appearanceStream.getBBox(); if (boundingBox == null) { boundingBox = fieldWidget.getRectangle().createRetranslatedRectangle(); } return boundingBox; }
private void assignSignatureRectangle(PDSignatureField signatureField, COSDictionary annotDict) { // Read and set the rectangle for visual signature COSArray rectArray = (COSArray) annotDict.getDictionaryObject(COSName.RECT); PDRectangle rect = new PDRectangle(rectArray); PDRectangle existingRectangle = signatureField.getWidgets().get(0).getRectangle(); //in case of an existing field keep the original rect if (existingRectangle == null || existingRectangle.getCOSArray().size() != 4) { signatureField.getWidgets().get(0).setRectangle(rect); } }
private void initRectMap() { PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm(); if (acroForm == null) { return; } for (PDField field : acroForm.getFieldTree()) { String fullyQualifiedName = field.getFullyQualifiedName(); for (PDAnnotationWidget widget : field.getWidgets()) { if (page.equals(widget.getPage())) { rectMap.put(widget.getRectangle(), fullyQualifiedName); } } } }
float widthOfField = widget.getRectangle().getWidth();
if (signature != null) rect = acroForm.getField(signatureFieldName).getWidgets().get(0).getRectangle();
private static PDAppearanceStream createRadioButtonAppearanceStream( final PDDocument document, PDAnnotationWidget widget, boolean on) throws IOException PDRectangle rect = widget.getRectangle(); PDAppearanceCharacteristicsDictionary appearanceCharacteristics; PDAppearanceStream yesAP = new PDAppearanceStream(document);
PDRectangle rect = widget.getRectangle(); if (rect == null)
private static PDAppearanceStream createCheckBoxAppearanceStream( final PDDocument document, PDAnnotationWidget widget, boolean on) throws IOException { PDRectangle rect = widget.getRectangle(); PDAppearanceStream onAP = new PDAppearanceStream(document); onAP.setBBox(new PDRectangle(rect.getWidth(), rect.getHeight())); try (PDAppearanceContentStream onAPCS = new PDAppearanceContentStream(onAP)) { PDAppearanceCharacteristicsDictionary appearanceCharacteristics = widget.getAppearanceCharacteristics(); PDColor backgroundColor = appearanceCharacteristics.getBackground(); PDColor borderColor = appearanceCharacteristics.getBorderColour(); float lineWidth = getLineWidth(widget); onAPCS.setBorderLine(lineWidth, widget.getBorderStyle(), widget.getBorder()); onAPCS.setNonStrokingColor(backgroundColor); float radius = Math.min(rect.getWidth() / 2, rect.getHeight() / 2); drawCircle(onAPCS, rect.getWidth() / 2, rect.getHeight() / 2, radius); onAPCS.fill(); onAPCS.setStrokingColor(borderColor); drawCircle(onAPCS, rect.getWidth() / 2, rect.getHeight() / 2, radius - lineWidth / 2); onAPCS.stroke(); if (on) { onAPCS.setNonStrokingColor(0f); drawCircle(onAPCS, rect.getWidth() / 2, rect.getHeight() / 2, (radius - lineWidth) / 2); onAPCS.fill(); } } return onAP; }
@Override void constructAppearances() throws IOException { PDAnnotationWidget widget = this.getWidgets().get(0); if (widget != null) { // check if the signature is visible if (widget.getRectangle() == null || widget.getRectangle().getHeight() == 0 && widget.getRectangle().getWidth() == 0 || widget.isNoView() || widget.isHidden()) { return; } // TODO: implement appearance generation for signatures LOG.warn("Appearance generation for signature fields not yet implemented - you need to generate/update that manually"); } } }
@Override void constructAppearances() throws IOException { PDAnnotationWidget widget = this.getWidgets().get(0); if (widget != null) { // check if the signature is visible if (widget.getRectangle() == null || widget.getRectangle().getHeight() == 0 && widget.getRectangle().getWidth() == 0 || widget.isNoView() || widget.isHidden()) { return; } // TODO: implement appearance generation for signatures LOG.warn("Appearance generation for signature fields not yet implemented - you need to generate/update that manually"); } } }
/** * Resolve the bounding box. * * @param fieldWidget the annotation widget. * @param appearanceStream the annotations appearance stream. * @return the resolved boundingBox. */ private PDRectangle resolveBoundingBox(PDAnnotationWidget fieldWidget, PDAppearanceStream appearanceStream) { PDRectangle boundingBox = appearanceStream.getBBox(); if (boundingBox == null) { boundingBox = fieldWidget.getRectangle().createRetranslatedRectangle(); } return boundingBox; }
/** * Resolve the bounding box. * * @param fieldWidget the annotation widget. * @param appearanceStream the annotations appearance stream. * @return the resolved boundingBox. */ private PDRectangle resolveBoundingBox(PDAnnotationWidget fieldWidget, PDAppearanceStream appearanceStream) { PDRectangle boundingBox = appearanceStream.getBBox(); if (boundingBox == null) { boundingBox = fieldWidget.getRectangle().createRetranslatedRectangle(); } return boundingBox; }
private void assignSignatureRectangle(PDSignatureField signatureField, COSDictionary annotDict) { // Read and set the rectangle for visual signature COSArray rectArray = (COSArray) annotDict.getDictionaryObject(COSName.RECT); PDRectangle rect = new PDRectangle(rectArray); PDRectangle existingRectangle = signatureField.getWidgets().get(0).getRectangle(); //in case of an existing field keep the original rect if (existingRectangle == null || existingRectangle.getCOSArray().size() != 4) { signatureField.getWidgets().get(0).setRectangle(rect); } }
private void assignSignatureRectangle(PDSignatureField signatureField, COSDictionary annotDict) { // Read and set the rectangle for visual signature COSArray rectArray = (COSArray) annotDict.getDictionaryObject(COSName.RECT); PDRectangle rect = new PDRectangle(rectArray); PDRectangle existingRectangle = signatureField.getWidgets().get(0).getRectangle(); //in case of an existing field keep the original rect if (existingRectangle == null || existingRectangle.getCOSArray().size() != 4) { signatureField.getWidgets().get(0).setRectangle(rect); } }
if (signature != null) rect = acroForm.getField(signatureFieldName).getWidgets().get(0).getRectangle();
PDRectangle rect = widget.getRectangle(); if (rect == null)
PDRectangle rect = widget.getRectangle(); if (rect == null)