Examples of PDAnnotationTextMarkup


Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

                contentStream.endText();

                contentStream.close();

                // Now add the markup annotation, a highlight to PDFBox text
                PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT);
                txtMark.setColour(colourBlue);
                txtMark.setConstantOpacity((float)0.2);   // Make the highlight 20% transparent

                // Set the rectangle containing the markup

                float textWidth = (font.getStringWidth( "PDFBox" )/1000) * 18;
                PDRectangle position = new PDRectangle();
                position.setLowerLeftX(inch);
                position.setLowerLeftY( ph-inch-18 );
                position.setUpperRightX(72 + textWidth);
                position.setUpperRightY(ph-inch);
                txtMark.setRectangle(position);

                // work out the points forming the four corners of the annotations
                // set out in anti clockwise form (Completely wraps the text)
                // OK, the below doesn't match that description.
                // It's what acrobat 7 does and displays properly!
                float[] quads = new float[8];

                quads[0] = position.getLowerLeftX()// x1
                quads[1] = position.getUpperRightY()-2; // y1
                quads[2] = position.getUpperRightX(); // x2
                quads[3] = quads[1]; // y2
                quads[4] = quads[0]// x3
                quads[5] = position.getLowerLeftY()-2; // y3
                quads[6] = quads[2]; // x4
                quads[7] = quads[5]; // y5

                txtMark.setQuadPoints(quads);
                txtMark.setContents("Highlighted since it's important");

                annotations.add(txtMark);

                // Now add the link annotation, so the clickme works
                PDAnnotationLink txtLink = new PDAnnotationLink();
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

    protected PDAnnotationTextMarkup pdFreeText = null;

    public FreeTextAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary)
    {
        super(ctx, annotDictionary);
        this.pdFreeText = new PDAnnotationTextMarkup(annotDictionary);
        this.pdAnnot = this.pdFreeText;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

    protected PDAnnotationTextMarkup pdMarkup = null;

    public MarkupAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary)
    {
        super(ctx, annotDictionary);
        this.pdMarkup = new PDAnnotationTextMarkup(annotDictionary);
        this.pdAnnot = this.pdMarkup;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

    protected PDAnnotationTextMarkup pdFreeText = null;

    public FreeTextAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary)
    {
        super(ctx, annotDictionary);
        this.pdFreeText = new PDAnnotationTextMarkup(annotDictionary);
        this.pdAnnot = this.pdFreeText;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

    protected PDAnnotationTextMarkup pdMarkup = null;

    public MarkupAnnotationValidator(PreflightContext ctx, COSDictionary annotDictionary)
    {
        super(ctx, annotDictionary);
        this.pdMarkup = new PDAnnotationTextMarkup(annotDictionary);
        this.pdAnnot = this.pdMarkup;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

  protected PDAnnotationTextMarkup pdMarkup = null;

  public MarkupAnnotationValidator(DocumentHandler handler,
      COSDictionary annotDictionary) {
    super(handler, annotDictionary);
    this.pdMarkup = new PDAnnotationTextMarkup(annotDictionary);
    this.pdAnnot = this.pdMarkup;
  }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

  protected PDAnnotationTextMarkup pdFreeText = null;

  public FreeTextAnnotationValidator(DocumentHandler handler,
      COSDictionary annotDictionary) {
    super(handler, annotDictionary);
    this.pdFreeText = new PDAnnotationTextMarkup(annotDictionary);
    this.pdAnnot = this.pdFreeText;
  }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

                contentStream.endText();

                contentStream.close();

                // Now add the markup annotation, a highlight to PDFBox text
                PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT);
                txtMark.setColour(colourBlue);
                txtMark.setConstantOpacity((float)0.2);   // Make the highlight 20% transparent

                // Set the rectangle containing the markup

                float textWidth = (font.getStringWidth( "PDFBox" )/1000) * 18;
                PDRectangle position = new PDRectangle();
                position.setLowerLeftX(inch);
                position.setLowerLeftY( ph-inch-18 );
                position.setUpperRightX(72 + textWidth);
                position.setUpperRightY(ph-inch);
                txtMark.setRectangle(position);

                // work out the points forming the four corners of the annotations
                // set out in anti clockwise form (Completely wraps the text)
                // OK, the below doesn't match that description.
                // It's what acrobat 7 does and displays properly!
                float[] quads = new float[8];

                quads[0] = position.getLowerLeftX()// x1
                quads[1] = position.getUpperRightY()-2; // y1
                quads[2] = position.getUpperRightX(); // x2
                quads[3] = quads[1]; // y2
                quads[4] = quads[0]// x3
                quads[5] = position.getLowerLeftY()-2; // y3
                quads[6] = quads[2]; // x4
                quads[7] = quads[5]; // y5

                txtMark.setQuadPoints(quads);
                txtMark.setContents("Highlighted since it's important");

                annotations.add(txtMark);

                // Now add the link annotation, so the clickme works
                PDAnnotationLink txtLink = new PDAnnotationLink();
View Full Code Here

Examples of org.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

                contentStream.endText();
               
                contentStream.close();
               
                // Now add the markup annotation, a highlight to PDFBox text
                PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT);
                txtMark.setColour(colourBlue);
                txtMark.setConstantOpacity((float)0.2);   // Make the highlight 20% transparent
               
                // Set the rectangle containing the markup

                float textWidth = (font.getStringWidth( "PDFBox" )/1000) * 18;
                PDRectangle position = new PDRectangle();
                position.setLowerLeftX(inch)
                position.setLowerLeftY( ph-inch-18 );
                position.setUpperRightX(72 + textWidth);
                position.setUpperRightY(ph-inch);
                txtMark.setRectangle(position);
               
                // work out the points forming the four corners of the annotations
                // set out in anti clockwise form (Completely wraps the text)
                // OK, the below doesn't match that description.
                // It's what acrobat 7 does and displays properly!
                float[] quads = new float[8];
               
                quads[0] = position.getLowerLeftX()// x1
                quads[1] = position.getUpperRightY()-2; // y1
                quads[2] = position.getUpperRightX(); // x2
                quads[3] = quads[1]; // y2
                quads[4] = quads[0]// x3
                quads[5] = position.getLowerLeftY()-2; // y3
                quads[6] = quads[2]; // x4
                quads[7] = quads[5]; // y5
               
                txtMark.setQuadPoints(quads);
                txtMark.setContents("Highlighted since it's important");
               
                annotations.add(txtMark);
               
                // Now add the link annotation, so the clickme works
                PDAnnotationLink txtLink = new PDAnnotationLink();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.