Example usage for com.lowagie.text PageSize A3

List of usage examples for com.lowagie.text PageSize A3

Introduction

In this page you can find the example usage for com.lowagie.text PageSize A3.

Prototype

Rectangle A3

To view the source code for com.lowagie.text PageSize A3.

Click Source Link

Document

This is the a3 format

Usage

From source file:com.qcadoo.mes.assignmentToShift.listeners.AssignmentToShiftReportDetailsListeners.java

License:Open Source License

public void generateAssignmentToShiftReportDocuments(final Entity assignmentToShiftReport, final Locale locale)
        throws IOException, DocumentException {

    String localePrefix = "assignmentToShift.assignmentToShiftReport.report.fileName";

    Entity assignmentToShiftReportWithFileName = fileService.updateReportFileName(assignmentToShiftReport,
            CREATE_DATE, localePrefix);/*from   w w  w  .ja  va2s  .  c  o  m*/

    try {
        assignmentReportXlsService.generateDocument(assignmentToShiftReportWithFileName, locale, PageSize.A3);

    } catch (IOException e) {
        throw new IllegalStateException("Problem with saving report");
    }
}

From source file:de.krutisch.jan.rasterizer.Rasterizer.java

License:Open Source License

private void setPageSize(String p) {
    if ("A4".equals(p)) {
        pageSize = PageSize.A4;//from   w  w w .  j a v  a2 s.com
    } else if ("A3".equals(p)) {
        pageSize = PageSize.A3;
    } else if ("LETTER".equals(p)) {
        pageSize = PageSize.LETTER;
    } else if ("LEGAL".equals(p)) {
        pageSize = PageSize.LEGAL;
    }
    if (pageSize == null)
        pageSize = PageSize.A4;
}

From source file:de.sub.goobi.forms.ProzessverwaltungForm.java

License:Open Source License

/**
 * Generate result as PDF.//from ww w .  j  av  a 2 s.c  om
 */
public void generateResultAsPdf() {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (!facesContext.getResponseComplete()) {

        /*
         * Vorbereiten der Header-Informationen
         */
        HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
        try {
            ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
            String contentType = servletContext.getMimeType("search.pdf");
            response.setContentType(contentType);
            response.setHeader("Content-Disposition", "attachment;filename=\"search.pdf\"");
            ServletOutputStream out = response.getOutputStream();

            SearchResultGeneration sr = new SearchResultGeneration(this.filter, this.showClosedProcesses,
                    this.showArchivedProjects);
            HSSFWorkbook wb = sr.getResult();
            List<List<HSSFCell>> rowList = new ArrayList<>();
            HSSFSheet mySheet = wb.getSheetAt(0);
            Iterator<Row> rowIter = mySheet.rowIterator();
            while (rowIter.hasNext()) {
                HSSFRow myRow = (HSSFRow) rowIter.next();
                Iterator<Cell> cellIter = myRow.cellIterator();
                List<HSSFCell> row = new ArrayList<>();
                while (cellIter.hasNext()) {
                    HSSFCell myCell = (HSSFCell) cellIter.next();
                    row.add(myCell);
                }
                rowList.add(row);
            }
            Document document = new Document();
            Rectangle a4quer = new Rectangle(PageSize.A3.getHeight(), PageSize.A3.getWidth());
            PdfWriter.getInstance(document, out);
            document.setPageSize(a4quer);
            document.open();
            if (rowList.size() > 0) {
                Paragraph p = new Paragraph(rowList.get(0).get(0).toString());
                document.add(p);
                PdfPTable table = new PdfPTable(9);
                table.setSpacingBefore(20);
                for (List<HSSFCell> row : rowList) {
                    for (HSSFCell hssfCell : row) {
                        // TODO aufhbschen und nicht toString() nutzen
                        String stringCellValue = hssfCell.toString();
                        table.addCell(stringCellValue);
                    }
                }
                document.add(table);
            }

            document.close();
            out.flush();
            facesContext.responseComplete();
        } catch (Exception e) {
            logger.error(e);
        }
    }
}

From source file:include.nseer_cookie.printPDF.java

License:Open Source License

public Document print_type_across(String print_type, int print_left, int print_right, int print_top,
        int print_bottom) {

    try {//from w  w w  . j av a  2 s. c om

        if (print_type.equals("A0"))
            document = new Document(PageSize.A0.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A1"))
            document = new Document(PageSize.A1.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A2"))
            document = new Document(PageSize.A2.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A3"))
            document = new Document(PageSize.A3.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A4"))
            document = new Document(PageSize.A4.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A5"))
            document = new Document(PageSize.A5.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A6"))
            document = new Document(PageSize.A6.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A7"))
            document = new Document(PageSize.A7.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A8"))
            document = new Document(PageSize.A8.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A9"))
            document = new Document(PageSize.A9.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B0"))
            document = new Document(PageSize.B0.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B1"))
            document = new Document(PageSize.B1.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B2"))
            document = new Document(PageSize.B2.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B3"))
            document = new Document(PageSize.B3.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B4"))
            document = new Document(PageSize.B4.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B5"))
            document = new Document(PageSize.B5.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_A"))
            document = new Document(PageSize.ARCH_A.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_B"))
            document = new Document(PageSize.ARCH_B.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_C"))
            document = new Document(PageSize.ARCH_C.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_D"))
            document = new Document(PageSize.ARCH_D.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_E"))
            document = new Document(PageSize.ARCH_E.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSA"))
            document = new Document(PageSize.FLSA.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSE"))
            document = new Document(PageSize.FLSE.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("NOTE"))
            document = new Document(PageSize.NOTE.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("_11X17"))
            document = new Document(PageSize._11X17.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LETTER"))
            document = new Document(PageSize.LETTER.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("HALFLETTER"))
            document = new Document(PageSize.HALFLETTER.rotate(), print_left, print_right, print_top,
                    print_bottom);
        if (print_type.equals("LEDGER"))
            document = new Document(PageSize.LEDGER.rotate(), print_left, print_right, print_top, print_bottom);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return document;
}

From source file:include.nseer_cookie.printPDF.java

License:Open Source License

public Document print_type_vertical(String print_type, int print_left, int print_right, int print_top,
        int print_bottom) {

    try {//from   w  ww  . ja  va2s .c o  m
        if (print_type.equals("A0"))
            document = new Document(PageSize.A0, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A1"))
            document = new Document(PageSize.A1, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A2"))
            document = new Document(PageSize.A2, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A3"))
            document = new Document(PageSize.A3, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A4"))
            document = new Document(PageSize.A4, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A5"))
            document = new Document(PageSize.A5, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A6"))
            document = new Document(PageSize.A6, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A7"))
            document = new Document(PageSize.A7, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A8"))
            document = new Document(PageSize.A8, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A9"))
            document = new Document(PageSize.A9, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B0"))
            document = new Document(PageSize.B0, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B1"))
            document = new Document(PageSize.B1, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B2"))
            document = new Document(PageSize.B2, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B3"))
            document = new Document(PageSize.B3, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B4"))
            document = new Document(PageSize.B4, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B5"))
            document = new Document(PageSize.B5, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_A"))
            document = new Document(PageSize.ARCH_A, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_B"))
            document = new Document(PageSize.ARCH_B, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_C"))
            document = new Document(PageSize.ARCH_C, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_D"))
            document = new Document(PageSize.ARCH_D, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_E"))
            document = new Document(PageSize.ARCH_E, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSA"))
            document = new Document(PageSize.FLSA, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSE"))
            document = new Document(PageSize.FLSE, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("NOTE"))
            document = new Document(PageSize.NOTE, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("_11X17"))
            document = new Document(PageSize._11X17, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LETTER"))
            document = new Document(PageSize.LETTER, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("HALFLETTER"))
            document = new Document(PageSize.HALFLETTER, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LEDGER"))
            document = new Document(PageSize.LEDGER, print_left, print_right, print_top, print_bottom);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return document;
}

From source file:net.refractions.udig.printing.ui.internal.template.A3LandscapeTemplate.java

License:Open Source License

protected Rectangle getPaperSize() {
    Rectangle a3 = PageSize.A3;
    Rectangle a3Landscape = new Rectangle(0f, 0f, a3.getHeight(), a3.getWidth());
    return a3Landscape;
}

From source file:net.refractions.udig.printing.ui.internal.template.A3PortraitTemplate.java

License:Open Source License

protected Rectangle getPaperSize() {
    Rectangle a3 = PageSize.A3;
    return a3;
}

From source file:net.sf.sze.service.impl.converter.PdfConverterImpl.java

License:GNU General Public License

/**
 * Orders the pages from an DIN-A4-document on a DIN-A3-document.
 * @param reader reader for DIN-A4-document
 * @param pdfFileA3 file in which the A3-document will be saved.
 * @param pages page-numbers in the order they will placed the paper in the
 * order left, right-side must be a multiple of 4. 0 is interpreted as an
 * empty-page.//from w  w  w.  j  a  v a  2s.co m
 * @throws DocumentException problems in iText.
 * @throws IOException io-problems.
 */
private void createA3Subdocument(PdfReader reader, File pdfFileA3, int... pages)
        throws DocumentException, IOException {
    if (pages.length % 4 != 0) {
        throw new IllegalArgumentException("The number of pages must be a " + "multiple of 4.");
    }

    // we retrieve the size of the first page
    final Rectangle psize = reader.getPageSize(1);
    final float width = psize.getWidth();
    final float leftMargin = 0f;
    final float topMargin = 0f;

    // step 1: creation of a document-object
    final Document document = new Document(PageSize.A3.rotate());
    // step 2: we create a writer that listens to the document
    final PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFileA3));
    writer.setPDFXConformance(PdfWriter.PDFA1B);
    // step 3: we open the document
    document.open();
    addPdfAInfosToDictonary(writer);

    // step 4: we add content
    final PdfContentByte cb = writer.getDirectContent();
    final PdfTemplate[] pdfPages = new PdfTemplate[pages.length];
    for (int i = 0; i < pdfPages.length; i++) {
        final int pageNr = pages[i];
        final PdfTemplate page;
        if (pageNr == EMPTY_PAGE) {
            page = writer.getImportedPage(getEmptyPDFPage(psize), 1);
        } else {
            page = writer.getImportedPage(reader, pageNr);
        }

        if (i % 2 == 0) {
            document.newPage();
            cb.addTemplate(page, 1f, 0f, 0f, 1f, leftMargin, topMargin);
        } else {
            cb.addTemplate(page, 1f, 0f, 0f, 1f, width + leftMargin, topMargin);
        }

    }

    writer.createXmpMetadata();
    // step 5: we close the document
    document.close();
}

From source file:optika.sql.java

public void eksportoNePdf(String id) {
    Document document = new Document() {
    };/*from  ww  w  .  ja  v  a2  s.  c o  m*/
    try {
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("receta.pdf"));
        document.open();
        document.setPageSize(PageSize.A3);

        Image img = Image.getInstance("receta.jpg");
        img.setAbsolutePosition(450f, 10f);

        img.scaleToFit(600, 849);

        img.setAlignment(Image.LEFT | Image.ALIGN_BOTTOM | Image.ALIGN_BASELINE);
        img.setAbsolutePosition(0, 0);
        document.add(img);
        String[][] receta = merrReceten("select * from recetat where id=" + parseInt(id) + ";");
        String[][] tabela = merrReceten("select * from tabela where recetat_id=" + parseInt(id) + ";");
        int[] white = new int[tabela.length];
        for (int i = 0; i < tabela.length; i++) {
            white[i] = 0;
            int bosh = 0;
            for (int j = 3; j < tabela[i].length; j++) {
                if (tabela[i][j] == tabela[i][6]) {
                    continue;
                }

                if (!tabela[i][j].isEmpty()) {
                    bosh = 1;
                }

            }

            if (bosh == 0) {
                white[i] = 1;
            }
        }
        Paragraph data = new Paragraph("Data: " + receta[0][7]);
        data.setSpacingBefore(38);
        data.setSpacingAfter(40);
        PdfPTable table = new PdfPTable(7);
        if (white[0] == 0) {
            table.addCell(getCellPadding("" + tabela[0][3], 1));
        } else {
            table.addCell(getCellWhite("_", 1, 30));
        }
        table.addCell(getCellPadding("" + tabela[0][4], 1));
        table.addCell(getCellPadding("" + tabela[0][5], 1));
        table.addCell(getCellPadding("", 1));
        table.addCell(getCellPadding("" + tabela[0][7], 1));
        table.addCell(getCellPadding("" + tabela[0][8], 1));
        table.addCell(getCellPadding("" + tabela[0][9], 1));
        table.setWidthPercentage(105);
        table.setHorizontalAlignment(-100);

        if (white[1] == 0) {
            table.addCell(getCellPadding("" + tabela[1][3], 1));
        } else {

            table.addCell(getCellWhite("_", 1, 36));
        }
        table.addCell(getCellPadding("" + tabela[1][4], 1));
        table.addCell(getCellPadding("" + tabela[1][5], 1));
        table.addCell(getCellPadding("", 1));
        table.addCell(getCellPadding("" + tabela[1][7], 1));
        table.addCell(getCellPadding("" + tabela[1][8], 1));
        table.addCell(getCellPadding("" + tabela[1][9], 1));
        table.setWidthPercentage(105);
        table.setHorizontalAlignment(-100);

        if (white[2] == 0) {
            if (white[1] == 0) {
                table.addCell(getCell("" + tabela[2][3], 1, 30));

            } else {
                table.addCell(getCellWhite("_", 1, 23));
            }
        } else {

            table.addCell(getCellWhite("_", 1, 28));

        }
        table.addCell(getCell("" + tabela[2][4], 1, 0));
        table.addCell(getCell("" + tabela[2][5], 1, 0));
        table.addCell(getCell("", 1, 0));
        table.addCell(getCell("" + tabela[2][7], 1, 0));
        table.addCell(getCell("" + tabela[2][8], 1, 0));
        table.addCell(getCell("" + tabela[2][9], 1, 0));
        table.setWidthPercentage(105);
        table.setSpacingBefore(27);
        table.setHorizontalAlignment(-100);

        String[][] distanca = merrReceten("select * from distanca where recetat_id=" + parseInt(id) + ";");

        PdfPTable largAfer = new PdfPTable(3);

        if (distanca[0][3].isEmpty()) {
            PdfPCell larg = getCellWhite("_", 2, 15);
            largAfer.addCell(larg);
        } else {
            PdfPCell larg = new PdfPCell(new Phrase("" + distanca[0][3]));
            larg.setPadding(0);
            larg.setHorizontalAlignment(2);
            larg.setBorder(PdfPCell.NO_BORDER);
            larg.setPaddingBottom(20);
            largAfer.addCell(larg);
        }
        largAfer.addCell(getCell("", PdfPCell.ALIGN_RIGHT, 25));

        if (distanca[0][8].isEmpty()) {
            largAfer.addCell(getCellWhite("_", PdfPCell.ALIGN_RIGHT, 15));
        } else {
            largAfer.addCell(getCell("" + distanca[0][8], PdfPCell.ALIGN_RIGHT, 25));
        }
        largAfer.setWidthPercentage(75);
        largAfer.setHorizontalAlignment(350);

        PdfPTable od_os = new PdfPTable(5);
        od_os.addCell(getCell("OD= " + distanca[0][4], 0, 195));
        od_os.addCell(getCell("OS= " + distanca[0][5], 2, 195));
        od_os.addCell(getCell("", 0, 0));
        od_os.addCell(getCell("OD= " + distanca[0][9], 0, 0));
        od_os.addCell(getCell("OS= " + distanca[0][10], 1, 0));
        od_os.setWidthPercentage(90);
        od_os.setHorizontalAlignment(150);

        PdfPTable visusi = new PdfPTable(2);
        if (distanca[0][6].isEmpty()) {
            PdfPCell od_pa = getCellWhite("_", 2, 17);
            od_pa.setPaddingRight(45);
            visusi.addCell(od_pa);
        } else {
            PdfPCell od_pa = getCell(distanca[0][6], 2, 17);
            od_pa.setPaddingRight(45);
            visusi.addCell(od_pa);
        }

        if (distanca[0][11].isEmpty()) {
            visusi.addCell(getCellWhite("_", 2, 17));
        } else {
            visusi.addCell(getCell(distanca[0][11], 2, 17));
        }

        if (distanca[0][7].isEmpty()) {
            PdfPCell os_pa = getCellWhite("_", 2, 17);
            os_pa.setPaddingRight(45);
            visusi.addCell(os_pa);
        } else {
            PdfPCell os_pa = getCell(distanca[0][7], 2, 17);
            os_pa.setPaddingRight(45);
            visusi.addCell(os_pa);
        }

        if (distanca[0][12].isEmpty()) {
            visusi.addCell(getCellWhite("_", 2, 17));
        } else {
            visusi.addCell(getCell(distanca[0][12], 2, 0));
        }
        visusi.setWidthPercentage(100);
        visusi.setHorizontalAlignment(50);

        String[][] admin = merrReceten("select * from admin where id=1;");
        PdfPTable klienti = new PdfPTable(3);
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("Emri: " + receta[0][2], 0, 0));

        klienti.addCell(getCell("Celular: " + admin[0][4], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        PdfPCell celReceta = getCell("Celular: " + receta[0][4], 0, 0);
        celReceta.setPaddingTop(5);
        klienti.addCell(celReceta);

        klienti.addCell(getCell("Email: " + admin[0][5], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        PdfPCell emailReceta = getCell("Email: " + receta[0][5], 0, 0);
        emailReceta.setPaddingBottom(5);
        emailReceta.setPaddingTop(5);
        klienti.addCell(emailReceta);

        klienti.addCell(getCell("Adresa: " + admin[0][6], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("Adresa: " + receta[0][6], 0, 0));
        klienti.setSpacingBefore(50);

        PdfPTable kreu = new PdfPTable(1);
        kreu.addCell(getCell(" ", 0, 0));

        document.add(kreu);
        document.add(klienti);
        document.add(data);
        document.add(table);
        document.add(largAfer);
        document.add(od_os);
        document.add(visusi);

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();

}

From source file:org.geomajas.plugin.print.command.print.LayoutAsSinglePageDoc.java

License:Open Source License

private static float getPageSizeRelativeToA3(PrintGetTemplateExtRequest request) {
    Rectangle r;//w w  w  . j a  va2  s  .co m
    if (request.getPageSize() != null) {
        r = PageSize.getRectangle(request.getPageSize());
    } else if (request.getTemplate().getPage().getLayoutConstraint().getWidth() > 0
            && request.getTemplate().getPage().getLayoutConstraint().getHeight() > 0) {
        float width = request.getTemplate().getPage().getLayoutConstraint().getWidth();
        float height = request.getTemplate().getPage().getLayoutConstraint().getHeight();
        r = new Rectangle(0, 0, width, height);
    } else {
        return 1.0f;
    }
    return (r.getWidth() / PageSize.A3.getWidth() + r.getHeight() / PageSize.A3.getHeight()) / 2;
}