Example usage for com.itextpdf.text.pdf PdfBorderDictionary STYLE_DASHED

List of usage examples for com.itextpdf.text.pdf PdfBorderDictionary STYLE_DASHED

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfBorderDictionary STYLE_DASHED.

Prototype

int STYLE_DASHED

To view the source code for com.itextpdf.text.pdf PdfBorderDictionary STYLE_DASHED.

Click Source Link

Usage

From source file:fc.extensions.itext.Writer.java

License:MIT License

/**
 * write PDF annotation for debugging./*from   w w w. j a  v a 2 s .  co  m*/
 */
public void writeAnnotation(String title, String content, float leftX, float bottomY, float rightX, float topY)
        throws Exception {
    try {
        pdfWriterCB.saveState();
        pdfWriterCB.setRGBColorStroke(255, 255, 0);
        pdfWriterCB.setLineWidth(1F);
        pdfWriterCB.rectangle(leftX, bottomY, rightX - leftX, topY - bottomY);
        pdfWriterCB.stroke();
        PdfFormField field = PdfFormField.createTextField(pdfWriter, false, false, 0);
        field.setWidget(new Rectangle(leftX, bottomY, rightX, topY), PdfAnnotation.HIGHLIGHT_INVERT);
        field.setFlags(PdfAnnotation.FLAGS_PRINT);
        field.setFieldName(title);
        field.setPage();
        field.setValueAsString(content);
        field.setBorderStyle(new PdfBorderDictionary(0.5F, PdfBorderDictionary.STYLE_DASHED));
        pdfWriter.addAnnotation(field);
    } finally {
        pdfWriterCB.restoreState();
    }
}