List of usage examples for org.apache.pdfbox.cos COSName writePDF
public void writePDF(OutputStream output) throws IOException
From source file:com.aaasec.sigserv.csspsupport.pdfbox.modifications.CsCOSWriter.java
License:Apache License
/** * visitFromName method comment.//from www .j a va2 s . c o m * * @param obj The object that is being visited. * * @throws COSVisitorException If there is an exception while visiting this * object. * * @return null */ public Object visitFromName(COSName obj) throws COSVisitorException { try { obj.writePDF(getStandardOutput()); return null; } catch (IOException e) { throw new COSVisitorException(e); } }
From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java
License:Apache License
private void writeColorSpace(PDColorSpace colorSpace) throws IOException { COSName key = null; if (colorSpace instanceof PDDeviceGray || colorSpace instanceof PDDeviceRGB || colorSpace instanceof PDDeviceCMYK) { key = COSName.getPDFName(colorSpace.getName()); } else {/*from ww w .ja v a2 s. co m*/ COSDictionary colorSpaces = (COSDictionary) resources.getCOSDictionary() .getDictionaryObject(COSName.COLORSPACE); if (colorSpaces == null) { colorSpaces = new COSDictionary(); resources.getCOSDictionary().setItem(COSName.COLORSPACE, colorSpaces); } key = colorSpaces.getKeyForValue(colorSpace.getCOSObject()); if (key == null) { int counter = 0; String csName = "CS"; while (colorSpaces.containsValue(csName + counter)) { counter++; } key = COSName.getPDFName(csName + counter); colorSpaces.setItem(key, colorSpace); } } key.writePDF(output); appendRawCommands(SPACE); }
From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java
License:Apache License
/** * This will append a {@link COSName} to the content stream. * /* ww w. j a va 2 s. c o m*/ * @param name * the name * @throws IOException * If an error occurs while writing to the stream. */ public void appendCOSName(COSName name) throws IOException { name.writePDF(output); }