Example usage for com.itextpdf.text PageSize PENGUIN_SMALL_PAPERBACK

List of usage examples for com.itextpdf.text PageSize PENGUIN_SMALL_PAPERBACK

Introduction

In this page you can find the example usage for com.itextpdf.text PageSize PENGUIN_SMALL_PAPERBACK.

Prototype

Rectangle PENGUIN_SMALL_PAPERBACK

To view the source code for com.itextpdf.text PageSize PENGUIN_SMALL_PAPERBACK.

Click Source Link

Document

This is the Pengiun small paperback format.

Usage

From source file:com.suyati.androidpdf.FirstPDFActivity.java

public void PrintDocument(String dest) throws IOException, java.io.IOException {
    try {//  ww w.j a  v  a2  s.  co m

        //            Document document = new Document();
        Document document = new Document(PageSize.PENGUIN_SMALL_PAPERBACK, 10f, 10f, 100f, 0f);//PENGUIN_SMALL_PAPERBACK used to set the paper size
        PdfWriter.getInstance(document, new FileOutputStream(dest));
        document.open();
        addMetaData(document);
        addTitlePage(document);
        addContent(document);
        document.close();

        File file = new File(dest);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file), "application/pdf");
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}