List of usage examples for com.lowagie.text.pdf PdfWriter VERSION_1_7
char VERSION_1_7
To view the source code for com.lowagie.text.pdf PdfWriter VERSION_1_7.
Click Source Link
From source file:de.xirp.report.ReportGenerator.java
License:Open Source License
/** * Generates the PDF from the/*from www. j av a2 s .c o m*/ * {@link de.xirp.report.Report} and writes the PDF * to a file. <br> * <br> * At first the title and header pages are created. After that the * content pages are created. * * @return The file name of the PDF. * @throws IOException * if something went wrong saving the PDF. * @throws DocumentException * if something went wrong generating the PDF. * @throws MalformedURLException * if something went wrong saving the PDF. * @see de.xirp.report.Report */ private static String generatePDF() throws DocumentException, MalformedURLException, IOException { String filename = report.getName().replaceAll(" ", "-") + "_report_" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + report.getHeader().getRobot().getName() + "_" //$NON-NLS-1$ + Util.getTimeAsString(report.getHeader().getDate()) + ".pdf"; //$NON-NLS-1$ reportFile = new File(Constants.REPORT_DIR + File.separator + filename); // creation of a document-object document = new Document(PageSize.A4); // we create a writer that listens to the document // and directs a PDF-stream to a file writer = PdfWriter.getInstance(document, new FileOutputStream(reportFile.getPath())); writer.setPdfVersion(PdfWriter.VERSION_1_7); writer.setStrictImageSequence(true); // open the document document.open(); // add the title page addReportTitle(); addReportContent(); // close the document document.close(); return filename; }