/** * Ends OCG layer. * * @return current canvas. */ public PdfCanvas endLayer() { int num; if (layerDepth != null && !layerDepth.isEmpty()) { num = (int) layerDepth.get(layerDepth.size() - 1); layerDepth.remove(layerDepth.size() - 1); } else { throw new PdfException(PdfException.UnbalancedLayerOperators); } while (num-- > 0) contentStream.getOutputStream().writeBytes(EMC).writeNewLine(); return this; }
/** * Moves to the next line and shows {@code text}. * * @param text the text to write * @return current canvas. */ public PdfCanvas newlineShowText(String text) { showTextInt(text); contentStream.getOutputStream() .writeByte('\'') .writeNewLine(); return this; }
private void addToPropertiesAndBeginLayer(IPdfOCG layer) { PdfName name = resources.addProperties(layer.getPdfObject()); contentStream.getOutputStream().write(PdfName.OC).writeSpace() .write(name).writeSpace().writeBytes(BDC).writeNewLine(); }
if (!PdfName.Type.equals(key) && !PdfName.Subtype.equals(key) && !PdfName.Length.equals(key)) { os.write(entry.getKey()).writeSpace(); os.write(entry.getValue()).writeNewLine(); os.write(new PdfNumber(imageBytes.length)).writeNewLine();; os.writeBytes(imageBytes).writeNewLine().writeBytes(EI).writeNewLine(); restoreState();
/** * Moves to the next line and shows text string, using the given values of the character and word spacing parameters. * * @param wordSpacing a parameter * @param charSpacing a parameter * @param text the text to write * @return current canvas. */ public PdfCanvas newlineShowText(float wordSpacing, float charSpacing, String text) { contentStream.getOutputStream() .writeFloat(wordSpacing) .writeSpace() .writeFloat(charSpacing); showTextInt(text); contentStream.getOutputStream() .writeByte('"') .writeNewLine(); // The " operator sets charSpace and wordSpace into graphics state // (cfr PDF reference v1.6, table 5.6) currentGs.setCharSpacing(charSpacing); currentGs.setWordSpacing(wordSpacing); return this; }
else if (colorSpace instanceof PdfSpecialCs.UncoloredTilingPattern) contentStream.getOutputStream().write(resources.addColorSpace(colorSpace)).writeSpace().writeBytes(fill ? cs : CS). writeNewLine().writeFloats(colorValue).writeSpace().write(resources.addPattern(pattern)).writeSpace().writeBytes(fill ? scn : SCN); else if (colorSpace instanceof PdfSpecialCs.Pattern) contentStream.getOutputStream().write(PdfName.Pattern).writeSpace().writeBytes(fill ? cs : CS). writeNewLine().write(resources.addPattern(pattern)).writeSpace().writeBytes(fill ? scn : SCN); else if (colorSpace.getPdfObject().isIndirect()) { if (!setColorValueOnly) {