Example usage for com.itextpdf.text PageSize A0

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

Introduction

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

Prototype

Rectangle A0

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

Click Source Link

Document

This is the a0 format

Usage

From source file:br.com.ifrn.panfleto.gui.PainelCadastrar.java

public Rectangle tamanhoDaPagina() {
    if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A0")) {
        return new Rectangle(PageSize.A0);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A1")) {
        return new Rectangle(PageSize.A1);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A2")) {
        return new Rectangle(PageSize.A2);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A3")) {
        return new Rectangle(PageSize.A3);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A4")) {
        return new Rectangle(PageSize.A4);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A5")) {
        return new Rectangle(PageSize.A5);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B0")) {
        return new Rectangle(PageSize.B0);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B1")) {
        return new Rectangle(PageSize.B1);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B2")) {
        return new Rectangle(PageSize.B2);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B3")) {
        return new Rectangle(PageSize.B3);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B4")) {
        return new Rectangle(PageSize.B4);
    } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B5")) {
        return new Rectangle(PageSize.B5);
    }/*  w w  w. j  a va 2 s  . c  o  m*/

    //caso erro, retorna o tamanho a4 como padrao
    return new Rectangle(PageSize.A4);
}

From source file:com.protheos.infomodel.ImportExport.java

License:Open Source License

public void script() {
    //Init a project - and therefore a workspace
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    pc.newProject();//w  w  w . j a  va  2  s . c om
    Workspace workspace = pc.getCurrentWorkspace();

    //Get controllers and models
    ImportController importController = Lookup.getDefault().lookup(ImportController.class);

    //Import file
    Container container;
    try {
        File file = new File(
                getClass().getResource("/org/gephi/toolkit/demos/resources/lesmiserables.gml").toURI());
        container = importController.importFile(file);
        container.getLoader().setEdgeDefault(EdgeDefault.DIRECTED); //Force DIRECTED
        container.setAllowAutoNode(false); //Don't create missing nodes
    } catch (Exception ex) {
        ex.printStackTrace();
        return;
    }

    //Append imported data to GraphAPI
    importController.process(container, new DefaultProcessor(), workspace);

    //Export full graph
    ExportController ec = Lookup.getDefault().lookup(ExportController.class);
    try {
        ec.exportFile(new File("io_gexf.gexf"));
    } catch (IOException ex) {
        ex.printStackTrace();
        return;
    }

    //Export only visible graph
    GraphExporter exporter = (GraphExporter) ec.getExporter("gexf"); //Get GEXF exporter
    exporter.setExportVisible(true); //Only exports the visible (filtered) graph
    exporter.setWorkspace(workspace);
    try {
        ec.exportFile(new File("io_gexf.gexf"), exporter);
    } catch (IOException ex) {
        ex.printStackTrace();
        return;
    }

    //Export to Writer
    Exporter exporterGraphML = ec.getExporter("graphml"); //Get GraphML exporter
    exporterGraphML.setWorkspace(workspace);
    StringWriter stringWriter = new StringWriter();
    ec.exportWriter(stringWriter, (CharacterExporter) exporterGraphML);
    //System.out.println(stringWriter.toString());   //Uncomment this line

    //PDF Exporter config and export to Byte array
    PDFExporter pdfExporter = (PDFExporter) ec.getExporter("pdf");
    pdfExporter.setPageSize(PageSize.A0);
    pdfExporter.setWorkspace(workspace);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ec.exportStream(baos, pdfExporter);
    byte[] pdf = baos.toByteArray();
}

From source file:es.guido.twitter.graph.GraphBuilder.java

License:Open Source License

public void export(String format, OutputStream os) throws IOException {
    configurePreview();// w w  w .  j  a  v  a  2  s  . com

    configureLayout();

    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    Workspace workspace = pc.getCurrentWorkspace();

    ExportController ec = Lookup.getDefault().lookup(ExportController.class);
    PDFExporter pdfExporter = (PDFExporter) ec.getExporter(format);
    pdfExporter.setPageSize(PageSize.A0);
    pdfExporter.setWorkspace(workspace);
    ec.exportStream(os, pdfExporter);
    os.flush();
}

From source file:org.fhaes.neofhchart.PDFExportOptionsDialog.java

License:Open Source License

/**
 * Handles when actions are performed on the dialog.
 *///from  w  ww.  j  a v  a2  s  .c o m
@Override
public void actionPerformed(ActionEvent evt) {

    if (evt.getActionCommand().equals("OK")) {
        // Perform the export operation
        boolean completedSuccessfully = doExportToPDF();

        if (completedSuccessfully) {
            MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.INFO,
                    FeedbackDisplayProtocol.AUTO_HIDE,
                    FeedbackDictionary.NEOFHCHART_PDF_EXPORT_MESSAGE.toString());
        } else {
            MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.ERROR,
                    FeedbackDisplayProtocol.MANUAL_HIDE,
                    "An error occured while attempting to export chart as PDF.");
        }

        this.dispose();
    } else if (evt.getActionCommand().equals("Cancel")) {
        // Close the dialog
        this.dispose();
    } else if (evt.getActionCommand().equals("PaperSize")) {
        // Update the paper size label
        if (this.cboPaperSize.getSelectedItem() instanceof Rectangle) {
            Object value = this.cboPaperSize.getSelectedItem();
            if (value.equals(PageSize.A5)) {
                this.lblSize.setText("148 x 210mm  /  5.83 x 8.27\"");
            } else if (value.equals(PageSize.A4)) {
                this.lblSize.setText("210 x 297mm  /  8.27 x 11.7\"");
            } else if (value.equals(PageSize.A3)) {
                this.lblSize.setText("297 x 420mm  /  11.7 x 16.5\"");
            } else if (value.equals(PageSize.A2)) {
                this.lblSize.setText("420 x 594mm  /  16.5 x 23.4\"");
            } else if (value.equals(PageSize.A1)) {
                this.lblSize.setText("594 x 841mm  /  23.4 x 33.1\"");
            } else if (value.equals(PageSize.A0)) {
                this.lblSize.setText("841 x 1189mm  /  33.1 x 46.8\"");
            } else if (value.equals(PageSize.LETTER)) {
                this.lblSize.setText("215.9 x 279.4mm  /  8.5 x 11\"");
            } else if (value.equals(PageSize.LEGAL)) {
                this.lblSize.setText("215.9 x 355.6mm  /  8.5 x 14\"");
            } else if (value.equals(PageSize.EXECUTIVE)) {
                this.lblSize.setText("184 x 267mm  /  7.25 x 10.5\"");
            } else {
                this.lblSize.setText("");
            }

            radLandscape.setEnabled(true);
            radPortrait.setEnabled(true);
        } else {
            this.lblSize.setText("");
            radLandscape.setEnabled(false);
            radPortrait.setEnabled(false);
        }
    }
}

From source file:org.gephi.ui.exporter.preview.UIExporterPDFPanel.java

License:Open Source License

public UIExporterPDFPanel() {
    initComponents();/* w  w  w . j a va2 s.co  m*/

    sizeFormatter = NumberFormat.getNumberInstance();
    sizeFormatter.setMaximumFractionDigits(3);
    marginFormatter = NumberFormat.getNumberInstance();
    marginFormatter.setMaximumFractionDigits(1);

    //Page size model - http://en.wikipedia.org/wiki/Paper_size
    DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
    comboBoxModel.addElement(new PageSizeItem(PageSize.A0, "A0", 841, 1189, 33.1, 46.8));
    comboBoxModel.addElement(new PageSizeItem(PageSize.A1, "A1", 594, 841, 23.4, 33.1));
    comboBoxModel.addElement(new PageSizeItem(PageSize.A2, "A2", 420, 594, 16.5, 23.4));
    comboBoxModel.addElement(new PageSizeItem(PageSize.A3, "A3", 297, 420, 11.7, 16.5));
    comboBoxModel.addElement(new PageSizeItem(PageSize.A4, "A4", 210, 297, 8.3, 11.7));
    comboBoxModel.addElement(new PageSizeItem(PageSize.A5, "A5", 148, 210, 5.8, 8.3));
    comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_A, "ARCH A", 229, 305, 9, 12));
    comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_B, "ARCH B", 305, 457, 12, 18));
    comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_C, "ARCH C", 457, 610, 18, 24));
    comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_D, "ARCH D", 610, 914, 24, 36));
    comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_E, "ARCH E", 914, 1219, 36, 48));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B0, "B0", 1000, 1414, 39.4, 55.7));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B1, "B1", 707, 1000, 27.8, 39.4));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B2, "B2", 500, 707, 19.7, 27.8));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B3, "B3", 353, 500, 13.9, 19.7));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B4, "B4", 250, 353, 9.8, 13.9));
    comboBoxModel.addElement(new PageSizeItem(PageSize.B5, "B5", 176, 250, 6.9, 9.8));
    comboBoxModel.addElement(new PageSizeItem(PageSize.LEDGER, "Ledger", 432, 279, 17, 11));
    comboBoxModel.addElement(new PageSizeItem(PageSize.LEGAL, "Legal", 216, 356, 8.5, 14));
    comboBoxModel.addElement(new PageSizeItem(PageSize.LETTER, "Letter", 216, 279, 8.5, 11));
    comboBoxModel.addElement(new PageSizeItem(PageSize.TABLOID, "Tabloid", 279, 432, 11, 17));

    customSizeString = NbBundle.getMessage(UIExporterPDFPanel.class, "UIExporterPDFPanel.pageSize.custom");
    comboBoxModel.addElement(customSizeString);
    pageSizeCombo.setModel(comboBoxModel);

    loadPreferences();

    initEvents();
    refreshUnit(false);
}

From source file:org.mc.okapi.Gephi.java

License:Open Source License

public void CreatePDFFile(Workspace workspace, String filename) throws IOException {
    if (filename == null || "".equals(filename)) {
        throw new IOException("Invalid file name.");
    } else {//from   w  w  w  .  java2  s  .c  o  m
        ExportController ec = Lookup.getDefault().lookup(ExportController.class);
        PDFExporter pdfExporter = (PDFExporter) ec.getExporter("pdf");
        pdfExporter.setPageSize(PageSize.A0);
        pdfExporter.setWorkspace(workspace);
        try {
            ec.exportFile(new File(filename + ".pdf"));
        } catch (IOException ex) {
            ex.printStackTrace();
            return;
        }
    }
}

From source file:org.saiku.web.export.PdfReport.java

License:Apache License

public byte[] pdf(QueryResult qr, String svg) throws Exception {

    int resultWidth = qr != null && qr.getCellset() != null && qr.getCellset().size() > 0
            ? qr.getCellset().get(0).length
            : 0;/* w  w w  . j a va2  s.c  o  m*/
    if (resultWidth == 0) {
        throw new SaikuServiceException("Cannot convert empty result to PDF");
    }
    Rectangle size = PageSize.A4.rotate();
    if (resultWidth > 8) {
        size = PageSize.A3.rotate();
    }
    if (resultWidth > 16) {
        size = PageSize.A2.rotate();
    }
    if (resultWidth > 32) {
        size = PageSize.A1.rotate();
    }
    if (resultWidth > 64) {
        size = PageSize.A0.rotate();
    }

    Document document = new Document(size, 15, 15, 10, 10);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter writer = PdfWriter.getInstance(document, baos);
    document.open();
    populatePdf(document, writer, qr);

    // do we want to add a svg image?
    if (StringUtils.isNotBlank(svg)) {
        document.newPage();
        StringBuffer s1 = new StringBuffer(svg);
        if (!svg.startsWith("<svg xmlns=\"http://www.w3.org/2000/svg\" ")) {
            s1.insert(s1.indexOf("<svg") + 4, " xmlns='http://www.w3.org/2000/svg'");
        }

        String t = "<?xml version='1.0' encoding='ISO-8859-1'" + " standalone='no'?>" + s1.toString();
        PdfContentByte cb = writer.getDirectContent();
        cb.saveState();
        cb.concatCTM(1.0f, 0, 0, 1.0f, 36, 0);
        float width = document.getPageSize().getWidth() - 20;
        float height = document.getPageSize().getHeight() - 20;
        Graphics2D g2 = cb.createGraphics(width, height);
        //g2.rotate(Math.toRadians(-90), 100, 100);
        PrintTranscoder prm = new PrintTranscoder();
        TranscoderInput ti = new TranscoderInput(new StringReader(t));
        prm.transcode(ti, null);
        PageFormat pg = new PageFormat();
        Paper pp = new Paper();
        pp.setSize(width, height);
        pp.setImageableArea(5, 5, width, height);
        pg.setPaper(pp);
        prm.print(g2, pg, 0);
        g2.dispose();
        cb.restoreState();
    }

    document.close();
    return baos.toByteArray();
}