List of usage examples for com.lowagie.text.pdf PdfWriter PDF_VERSION_1_5
PdfName PDF_VERSION_1_5
To view the source code for com.lowagie.text.pdf PdfWriter PDF_VERSION_1_5.
Click Source Link
From source file:org.mapfish.print.MapPrinter.java
License:Open Source License
/** * Generate the PDF using the given spec. * * @return The context that was used for printing. *//*from w w w. ja v a 2 s . co m*/ public RenderingContext print(PJsonObject jsonSpec, OutputStream outFile, String referer) throws DocumentException { final String layoutName = jsonSpec.getString(Constants.JSON_LAYOUT_KEY); Layout layout = config.getLayout(layoutName); if (layout == null) { throw new RuntimeException("Unknown layout '" + layoutName + "'"); } Document doc = new Document(layout.getFirstPageSize(null, jsonSpec)); PdfWriter writer = PdfWriter.getInstance(doc, outFile); if (!layout.isSupportLegacyReader()) { writer.setFullCompression(); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_5); writer.setCompressionLevel(PdfStream.BEST_COMPRESSION); } RenderingContext context = new RenderingContext(doc, writer, config, jsonSpec, configDir, layout, referer); layout.render(jsonSpec, context); doc.close(); writer.close(); return context; }