pdfboxprototype.Tick.java Source code

Java tutorial

Introduction

Here is the source code for pdfboxprototype.Tick.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pdfboxprototype;

import java.awt.Color;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;

/**
 *
 * @author Rob
 */
public class Tick extends Annotation {
    /**
     * Empty constructor
     */
    public Tick() {

    }

    /**
     * Constructor for Tick
     *
     * @param x
     * @param y
     */
    public Tick(int x, int y) {
        this.x = x;
        this.y = y;
        this.rectangle = new PDRectangle();
    }

    /**
     * Draw method
     *
     * @param contentStream
     */
    @Override
    public void draw(PDPageContentStream contentStream) {
        try {
            contentStream.setStrokingColor(Color.green);
            contentStream.drawLine(this.x, this.y - 20, this.x + 5, this.y - 25);
            contentStream.drawLine(this.x + 5, this.y - 25, this.x + 25, this.y);
            contentStream.close();
        } catch (IOException ex) {
            Logger.getLogger(Cross.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}