Example usage for com.itextpdf.text.pdf PdfWriter PageLayoutSinglePage

List of usage examples for com.itextpdf.text.pdf PdfWriter PageLayoutSinglePage

Introduction

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

Prototype

int PageLayoutSinglePage

To view the source code for com.itextpdf.text.pdf PdfWriter PageLayoutSinglePage.

Click Source Link

Document

A viewer preference

Usage

From source file:architecture.ee.web.view.document.AbstractPdfView.java

License:Apache License

/**
 * Return the viewer preferences for the PDF file.
 * <p>By default returns <code>AllowPrinting</code> and
 * <code>PageLayoutSinglePage</code>, but can be subclassed.
 * The subclass can either have fixed preferences or retrieve
 * them from bean properties defined on the View.
 * @return an int containing the bits information against PdfWriter definitions
 * @see com.lowagie.text.pdf.PdfWriter#AllowPrinting
 * @see com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage
 *//*w  ww  .j av a2s.  c  om*/
protected int getViewerPreferences() {
    return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}

From source file:com.app.gpo.pdf.utils.AbstractITextPdfView.java

License:Open Source License

protected int getViewerPreferences() {
    return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}

From source file:com.sapito.direccion.PdfView.java

@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    ByteArrayOutputStream baos = createTemporaryOutputStream();
    Document document = new Document(PageSize.LETTER);
    PdfWriter pdfWriter = PdfWriter.getInstance(document, baos);
    pdfWriter.setViewerPreferences(PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage);

    document.open();//from ww w.j  a  v a  2s .  c  om
    buildPdfDocument(model, document, pdfWriter, request, response);
    document.close();

    response.setHeader("Content-Disposition",
            "attachment; filename=" + model.get("filename").toString() + ".pdf");
    //response.setContentLength(baos.size());
    System.out.println("size:" + baos.size());
    writeToResponse(response, baos);

}