List of usage examples for com.lowagie.text PageSize LEGAL
Rectangle LEGAL
To view the source code for com.lowagie.text PageSize LEGAL.
Click Source Link
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 www . j a v a 2 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:net.refractions.udig.printing.ui.internal.template.LegalLandscapeTemplate.java
License:Open Source License
protected Rectangle getPaperSize() { Rectangle legal = PageSize.LEGAL; Rectangle legalLandscape = new Rectangle(0f, 0f, legal.getHeight(), legal.getWidth()); return legalLandscape; }
From source file:net.refractions.udig.printing.ui.internal.template.LetterPortraitTemplate.java
License:Open Source License
protected Rectangle getPaperSize() { Rectangle legal = PageSize.LEGAL; return legal; }
From source file:org.tn5250j.spoolfile.SpoolExportWizard.java
License:Open Source License
/** * Open the correct type of output file depending on selection(s) *///from w w w. j av a 2 s. co m public void openOutputFile() { try { // update status updateStatus("Opening File"); // default to txt extention String suffix = ".txt"; String fileName = ""; // if pdf then change to pdf extenstion if (cvtType.getSelectedIndex() == 0) suffix = ".pdf"; // for e-mailing setup a temporary file if (email.isSelected()) { File dir = new File(System.getProperty("user.dir")); // setup the temp file name String tempFile = spooledFile.getText().trim() + '_' + jobName.getText().trim() + '_' + user.getText().trim() + '_' + spooledFileNumber.getText().trim() + '_' + number.getText().trim(); // create the temporary file File f = File.createTempFile(tempFile, suffix, dir); System.out.println(f.getName()); System.out.println(f.getCanonicalPath()); conicalPath = f.getCanonicalPath(); // set it to delete on exit f.deleteOnExit(); // create the file fw = new FileOutputStream(f); } else if (ifs.isSelected()) { fileName = ifsPathInfo.getText().trim(); ifsfw = new IFSFileOutputStream(splfile.getSystem(), fileName); } else { fileName = pcPathInfo.getText().trim(); fw = new FileOutputStream(fileName); } // if not PDF then this is all we have to do so return if (cvtType.getSelectedIndex() > 0) return; // On pdf's then we need to create a PDF document if (document == null) { document = new Document(); // create the pdf writer based on selection of pc or ifs file if (ifs.isSelected()) { bos = PdfWriter.getInstance(document, ifsfw); } else { bos = PdfWriter.getInstance(document, fw); } // create the base font BaseFont bf = BaseFont.createFont("Courier", "Cp1252", false); // set the default size of the font to 9.0 float fontsize = 9.0f; // if we have a font selectd then try to use it if (fontSize.getText().length() > 0) fontsize = Float.parseFloat(fontSize.getText().trim()); // create the pdf font to use within the document font = new com.lowagie.text.Font(bf, fontsize, com.lowagie.text.Font.NORMAL); // set the PDF properties of the supplied properties if (author.getText().length() > 0) document.addAuthor(author.getText()); if (title.getText().length() > 0) document.addTitle(title.getText()); if (subject.getText().length() > 0) document.addSubject(subject.getText()); // set the page sizes and the page orientation String ps = (String) pageSize.getSelectedItem(); if (ps.equals("A3")) { if (portrait.isSelected()) document.setPageSize(PageSize.A3); else document.setPageSize(PageSize.A3.rotate()); } if (ps.equals("A4")) { if (portrait.isSelected()) document.setPageSize(PageSize.A4); else document.setPageSize(PageSize.A4.rotate()); } if (ps.equals("A5")) { if (portrait.isSelected()) document.setPageSize(PageSize.A5); else document.setPageSize(PageSize.A5.rotate()); } if (ps.equals("LETTER")) { if (portrait.isSelected()) document.setPageSize(PageSize.LETTER); else document.setPageSize(PageSize.LETTER.rotate()); } if (ps.equals("LEGAL")) { if (portrait.isSelected()) document.setPageSize(PageSize.LEGAL); else document.setPageSize(PageSize.LEGAL.rotate()); } if (ps.equals("LEDGER")) { if (portrait.isSelected()) document.setPageSize(PageSize.LEDGER); else document.setPageSize(PageSize.LEDGER.rotate()); } } } catch (IOException _ex) { System.out.println("Cannot open 1 " + _ex.getMessage()); } catch (Exception _ex2) { System.out.println("Cannot open 2 " + _ex2.getMessage()); } }
From source file:webBoltOns.server.reportWriter.JRivetWriter.java
License:Open Source License
/** * <h2><code>buildReport</code></h2> * /*from ww w. ja v a2s . c o m*/ * <p> * Create the PDF report * </p> * * @param ServletRequest request - the HTTP request * @param ServletResponse response - the HTTP respones * */ private void buildReport(ServletRequest request, ServletResponse response, DataSet reportTable) { try { rowCount = 999; totalRows = 0; document = new Document(PageSize.LEGAL.rotate()); document.setMargins(8.0f, 8.0f, 8.0f, 18.0f); outputStream = new ByteArrayOutputStream(); writer = PdfWriter.getInstance(document, outputStream); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); buildReportTitles(reportTable); document.open(); contentByte = writer.getDirectContent(); root = new PdfOutline(contentByte.getRootOutline(), new PdfDestination(PdfDestination.FIT), "Report"); topA.setOutline(root); ResultSet resultSet; Statement statement = dataAccess.execConnectReadOnly(); sql = new StringBuffer(reportTable.getStringField(ReportColumn.SQL_QUERY)); sql = DataSet.removeFormat(sql, "\n"); sql = DataSet.removeFormat(sql, "\t"); Enumeration parameters = request.getParameterNames(); while (parameters.hasMoreElements()) { String p = (String) parameters.nextElement(); String v = request.getParameter(p); if (!p.equals("ReportScript") && !p.equals("") && !v.equals("")) sql = mergeTagValues(sql, p, v); } resultSet = statement.executeQuery(sql.toString().trim()); String[] record = new String[reportColumns.length]; while (resultSet.next()) { for (int c = 0; c < reportColumns.length; c++) { ReportColumn column = (ReportColumn) reportColumns[c]; String value = (String) DataAccess.getFieldValue(resultSet, column.getFeildName(), column.getDataType()); record[c] = formatField(value, column.getDataType(), column.getDecimals()); } topA.recursiveLevelBreaks(record); buildDetilLine(record); accumulateReportTotals(record); totalRows++; } if (totalRows == 0) { buildEmptyPage(request, response); } else { topA.fireGrandTotalBreak(); resultSet.close(); dataAccess.execClose(statement); document.add(reportBody); document.close(); buildPDFReportPage(request, response, outputStream.toByteArray()); } } catch (DocumentException e) { gs.log("** DocumentException: " + e); buildErrorPage(request, response, e.toString()); } catch (IOException e) { gs.log("** IOException: " + e); buildErrorPage(request, response, e.toString()); } catch (Exception e) { gs.log("** Exception: " + e); buildErrorPage(request, response, e.toString()); } }