Example usage for com.itextpdf.text.pdf PdfName toPdf

List of usage examples for com.itextpdf.text.pdf PdfName toPdf

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfName toPdf.

Prototype

public void toPdf(PdfWriter writer, OutputStream os) throws IOException 

Source Link

Document

Writes the PDF representation of this PdfObject as an array of bytes to the writer.

Usage

From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpContentOperator.java

License:Open Source License

private void writeStroke(PdfContentByte canvas, Path path, PdfName strokeColorSpace) throws IOException {
    canvas.getInternalBuffer().append(q);

    if (strokeColorSpace != null) {
        strokeColorSpace.toPdf(canvas.getPdfWriter(), canvas.getInternalBuffer());
        canvas.getInternalBuffer().append(' ').append(cs);
    }//  w  w w  .java 2s. c o  m

    List<PdfObject> strokeColorOperands = cleanUpStrategy.getContext().peekStrokeColor();
    String strokeOperatorStr = strokeColorOperands.get(strokeColorOperands.size() - 1).toString();
    // Below expression converts stroke color operator to its fill analogue.
    strokeColorOperands.set(strokeColorOperands.size() - 1, new PdfLiteral(strokeOperatorStr.toLowerCase()));
    writeOperands(canvas, strokeColorOperands);

    writePath(path, f, canvas);

    canvas.getInternalBuffer().append(Q);
}