Example usage for com.itextpdf.text.pdf PdfImage PdfImage

List of usage examples for com.itextpdf.text.pdf PdfImage PdfImage

Introduction

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

Prototype


public PdfImage(Image image, String name, PdfIndirectReference maskRef) throws BadPdfFormatException 

Source Link

Document

Constructs a PdfImage-object.

Usage

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

License:Open Source License

private void updateImageStream(PRStream imageStream, byte[] newData)
        throws BadElementException, IOException, BadPdfFormatException {
    PdfImage image = new PdfImage(Image.getInstance(newData), "", null);

    if (imageStream.contains(PdfName.SMASK)) {
        image.put(PdfName.SMASK, imageStream.get(PdfName.SMASK));
    }/*from w  w  w  . jav  a 2s .  c o  m*/

    if (imageStream.contains(PdfName.MASK)) {
        image.put(PdfName.MASK, imageStream.get(PdfName.MASK));
    }

    if (imageStream.contains(PdfName.SMASKINDATA)) {
        image.put(PdfName.SMASKINDATA, imageStream.get(PdfName.SMASKINDATA));
    }

    imageStream.clear();
    imageStream.putAll(image);
    imageStream.setDataRaw(image.getBytes());
}