List of usage examples for com.itextpdf.text.pdf PdfWriter setDefaultColorspace
public void setDefaultColorspace(final PdfName key, final PdfObject cs)
From source file:shared.SVGtoPDF.java
License:Open Source License
/** * Creates a PDF document./*w w w. j a va 2 s. c o m*/ * @param path * @param filename the path to the new PDF document * @throws DocumentException * @throws IOException * @throws SQLException */ public void createPdf(String svgDocument, Point size, String path) throws IOException, DocumentException { svgDocument = convertSVG(svgDocument); Document document = new Document(new Rectangle(size.x, size.y)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(path)); //writer.setRgbTransparencyBlending(false); writer.setDefaultColorspace(PdfName.DEFAULTCMYK, PdfName.DEFAULTCMYK); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate template = cb.createTemplate(size.x, size.y); drawSvg(svgDocument, template, size); cb.addTemplate(template, 0, 0); // step 5 document.close(); }