Example usage for com.itextpdf.text.pdf PdfContentByte getPdfWriter

List of usage examples for com.itextpdf.text.pdf PdfContentByte getPdfWriter

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfContentByte getPdfWriter.

Prototype

public PdfWriter getPdfWriter() 

Source Link

Document

Gets the PdfWriter in use by this object.

Usage

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

License:Open Source License

private void writeLine(Line line, PdfContentByte canvas) throws IOException {
    Point2D destination = line.getBasePoints().get(1);

    new PdfNumber(destination.getX()).toPdf(canvas.getPdfWriter(), canvas.getInternalBuffer());
    canvas.getInternalBuffer().append(' ');

    new PdfNumber(destination.getY()).toPdf(canvas.getPdfWriter(), canvas.getInternalBuffer());
    canvas.getInternalBuffer().append(l);
}

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);
    }//from  w ww .  jav  a2 s  . 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);
}

From source file:se.billes.pdf.renderer.request.factory.ImageFactory.java

License:Open Source License

public ImageInstance getImageByFile(PdfContentByte cb, File file) throws IOException, BadElementException {
    Image image = null;/*from   w w w  .j av  a2  s  .c  o m*/
    ImageInstance instance = null;
    if (file.getName().toLowerCase().endsWith(".pdf")) {
        PdfReader reader = new PdfReader(file.getAbsolutePath());
        PdfImportedPage p = cb.getPdfWriter().getImportedPage(reader, 1);
        image = Image.getInstance(p);
        instance = new ImageInstance(image, reader);
    } else {
        image = Image.getInstance(file.getAbsolutePath());
        instance = new ImageInstance(image, null);
    }

    instances.add(instance);

    return instance;
}