Example usage for com.lowagie.text.pdf PdfWriter setPageXmpMetadata

List of usage examples for com.lowagie.text.pdf PdfWriter setPageXmpMetadata

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfWriter setPageXmpMetadata.

Prototype

public void setPageXmpMetadata(byte[] xmpMetadata) 

Source Link

Document

Use this method to set the XMP Metadata for each page.

Usage

From source file:org.xhtmlrenderer.pdf.ITextRenderer.java

License:Open Source License

private void provideMetadataToPage(PdfWriter writer, PageBox page) {
    byte[] metadata = null;
    if (page.getMetadata() != null) {
        try {//from w  w w  .ja  v  a  2  s . c  o  m
            String metadataBody = stringfyMetadata(page.getMetadata());
            if (metadataBody != null) {
                metadata = createXPacket(stringfyMetadata(page.getMetadata())).getBytes("UTF-8");
            }
        } catch (UnsupportedEncodingException e) {
            // Can't happen
            throw new RuntimeException(e);
        }
    }

    if (metadata != null) {
        writer.setPageXmpMetadata(metadata);
    }
}