private void write(PdfName name) { writeByte('/'); writeBytes(name.getInternalContent()); }
/** * 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 write(PdfArray pdfArray) { writeByte('['); for (int i = 0; i < pdfArray.size(); i++) { PdfObject value = pdfArray.get(i, false); PdfIndirectReference indirectReference; if ((indirectReference = value.getIndirectReference()) != null) { write(indirectReference); } else { write(value); } if (i < pdfArray.size() - 1) writeSpace(); } writeByte(']'); }
/** * Changes the value of the <VAR>line dash pattern</VAR>. * <br> * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length * of the alternating dashes and gaps. The phase specifies the distance into the dash * pattern to start the dash. * * @param phase the value of the phase * @return current canvas. */ public PdfCanvas setLineDash(float phase) { currentGs.setDashPattern(getDashPatternArray(phase)); contentStream.getOutputStream().writeByte('[').writeByte(']').writeSpace() .writeFloat(phase).writeSpace() .writeBytes(d); return this; }
/** * 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; }
/** * Changes the value of the <VAR>line dash pattern</VAR>. * <br> * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length * of the alternating dashes and gaps. The phase specifies the distance into the dash * pattern to start the dash. * * @param phase the value of the phase * @param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off'). * @return current canvas. */ public PdfCanvas setLineDash(float unitsOn, float phase) { currentGs.setDashPattern(getDashPatternArray(new float[]{unitsOn}, phase)); contentStream.getOutputStream().writeByte('[').writeFloat(unitsOn).writeByte(']').writeSpace() .writeFloat(phase).writeSpace() .writeBytes(d); return this; }
int first = (int) sections.get(k); int len = (int) sections.get(k + 1); writer.writeInteger(first).writeSpace().writeInteger(len).writeByte((byte) '\n'); for (int i = first; i < first + len; i++) { PdfIndirectReference reference = xrefTable.get(i);
/** * Changes the value of the <VAR>line dash pattern</VAR>. * <br> * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length * of the alternating dashes and gaps. The phase specifies the distance into the dash * pattern to start the dash. * * @param array length of the alternating dashes and gaps * @param phase the value of the phase * @return current canvas. */ public PdfCanvas setLineDash(float[] array, float phase) { currentGs.setDashPattern(getDashPatternArray(array, phase)); PdfOutputStream out = contentStream.getOutputStream(); out.writeByte('['); for (int iter = 0; iter < array.length; iter++) { out.writeFloat(array[iter]); if (iter < array.length - 1) out.writeSpace(); } out.writeByte(']').writeSpace().writeFloat(phase).writeSpace().writeBytes(d); return this; }
/** * Changes the value of the <VAR>line dash pattern</VAR>. * <br> * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length * of the alternating dashes and gaps. The phase specifies the distance into the dash * pattern to start the dash. * * @param phase the value of the phase * @param unitsOn the number of units that must be 'on' * @param unitsOff the number of units that must be 'off' * @return current canvas. */ public PdfCanvas setLineDash(float unitsOn, float unitsOff, float phase) { currentGs.setDashPattern(getDashPatternArray(new float[]{unitsOn, unitsOff}, phase)); contentStream.getOutputStream().writeByte('[').writeFloat(unitsOn).writeSpace() .writeFloat(unitsOff).writeByte(']').writeSpace() .writeFloat(phase).writeSpace() .writeBytes(d); return this; }