/** * End a marked content sequence. * * @throws IOException If the content stream could not be written */ public void endMarkedContent() throws IOException { writeOperator("EMC"); }
/** * Fills the path using the nonzero winding number rule. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void fill() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fill is not allowed within a text block."); } writeOperator("f"); }
/** * Fills the path using the even-odd winding rule. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void fillEvenOdd() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fillEvenOdd is not allowed within a text block."); } writeOperator("f*"); }
/** * Move to the start of the next line of text. Requires the leading (see {@link #setLeading}) * to have been set. * * @throws IOException If there is an error writing to the stream. */ public void newLine() throws IOException { if (!inTextMode) { throw new IllegalStateException("Must call beginText() before newLine()"); } writeOperator("T*"); }
/** * Stroke the path. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void stroke() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: stroke is not allowed within a text block."); } writeOperator("S"); }
/** * Close and stroke the path. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void closeAndStroke() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: closeAndStroke is not allowed within a text block."); } writeOperator("s"); }
/** * Closes the current subpath. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void closePath() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: closePath is not allowed within a text block."); } writeOperator("h"); }
/** * End some text operations. * * @throws IOException If there is an error writing to the stream or if you attempt to * nest endText calls. * @throws IllegalStateException If the method was not allowed to be called at this time. */ public void endText() throws IOException { if (!inTextMode) { throw new IllegalStateException("Error: You must call beginText() before calling endText."); } writeOperator("ET"); inTextMode = false; }
/** * Fill and then stroke the path, using the nonzero winding number rule to determine the region * to fill. This shall produce the same result as constructing two identical path objects, * painting the first with {@link #fill() } and the second with {@link #stroke() }. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void fillAndStroke() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fillAndStroke is not allowed within a text block."); } writeOperator("B"); }
/** * Fill and then stroke the path, using the even-odd rule to determine the region to * fill. This shall produce the same result as constructing two identical path objects, painting * the first with {@link #fillEvenOdd() } and the second with {@link #stroke() }. * * @throws IOException If the content stream could not be written * @throws IllegalStateException If the method was called within a text block. */ public void fillAndStrokeEvenOdd() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fillAndStrokeEvenOdd is not allowed within a text block."); } writeOperator("B*"); }
/** * Set the horizontal scaling to scale / 100. * * @param scale number specifying the percentage of the normal width. Default value: 100 (normal * width). * @throws IOException If the content stream could not be written. */ public void setHorizontalScaling(float scale) throws IOException { writeOperand(scale); writeOperator("Tz"); }
/** * Begin a marked content sequence. * * @param tag the tag * @throws IOException If the content stream could not be written */ public void beginMarkedContent(COSName tag) throws IOException { writeOperand(tag); writeOperator("BMC"); }
/** * Set the character spacing. The value shall be added to the horizontal or vertical component * of the glyph's displacement, depending on the writing mode. * * @param spacing character spacing * @throws IOException If the content stream could not be written. */ public void setCharacterSpacing(float spacing) throws IOException { writeOperand(spacing); writeOperator("Tc"); }
/** * Sets the text leading. * * @param leading The leading in unscaled text units. * @throws IOException If there is an error writing to the stream. */ public void setLeading(float leading) throws IOException { writeOperand(leading); writeOperator("TL"); }
/** * Set the text rise value, i.e. move the baseline up or down. This is useful for drawing * superscripts or subscripts. * * @param rise Specifies the distance, in unscaled text space units, to move the baseline up or * down from its default location. 0 restores the default location. * @throws IOException */ public void setTextRise(float rise) throws IOException { writeOperand(rise); writeOperator("Ts"); }
/** * The cm operator. Concatenates the given matrix with the CTM. * * @param matrix the transformation matrix * @throws IOException If there is an error writing to the stream. */ public void transform(Matrix matrix) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: Modifying the current transformation matrix is not allowed within text objects."); } writeAffineTransform(matrix.createAffineTransform()); writeOperator("cm"); }
/** * Set an extended graphics state. * * @param state The extended graphics state. * @throws IOException If the content stream could not be written. */ public void setGraphicsStateParameters(PDExtendedGraphicsState state) throws IOException { writeOperand(resources.add(state)); writeOperator("gs"); }
/** * Set the text rendering mode. This determines whether showing text shall cause glyph outlines * to be stroked, filled, used as a clipping boundary, or some combination of the three. * * @param rm The text rendering mode. * @throws IOException If the content stream could not be written. */ public void setRenderingMode(RenderingMode rm) throws IOException { writeOperand(rm.intValue()); writeOperator("Tr"); }
/** * Shows the given text at the location specified by the current text matrix. * * @param text The Unicode text to show. * @throws IOException If an io exception occurs. * @throws IllegalArgumentException if a character isn't supported by the current font */ public void showText(String text) throws IOException { showTextInternal(text); write(" "); writeOperator("Tj"); }
/** * Begin a marked content sequence with a reference to an entry in the page resources' * Properties dictionary. * * @param tag the tag * @param propertyList property list * @throws IOException If the content stream could not be written */ public void beginMarkedContent(COSName tag, PDPropertyList propertyList) throws IOException { writeOperand(tag); writeOperand(resources.add(propertyList)); writeOperator("BDC"); }