org.foray.pdf.object
Class PDFContentStream

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFStream
          extended by org.foray.pdf.object.PDFContentStream
All Implemented Interfaces:
org.axsl.pdf.PdfContentStream

public class PDFContentStream
extends PDFStream
implements org.axsl.pdf.PdfContentStream

Specialized version of PDFStream with methods useful in creating PDF content streams.


Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFContentStream(PDFDocument doc)
          Create a PDFContentStream.
 
Method Summary
 void close()
           
 void closeTextObject()
          Closes any open text object.
 void drawGraphic(org.axsl.graphic.Graphic image, Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle, org.axsl.font.FontConsumer fontConsumer, boolean strokeText)
           
 void drawLine(Line2D.Float line)
           
 void drawRectangle(Rectangle2D.Float rectangle, boolean stroke, boolean fill)
           
 void drawText(CharSequence text, org.axsl.font.FontOptions fontOptions, org.axsl.common.i18n.Orthography orthography)
           
protected  void finalizeStreamContent()
          This method is an explicit opportunity for subclasses to finish writing whatever content may still need to be written to the stream before the dictionary and stream contents are written.
 void openTextObject()
          Makes the stream ready to accept text manipulation operators.
 void setCharacterSpacing(float newCharacterSpacing)
           
 void setColor(Color newColor, boolean stroke)
           
 void setCursor(float originX, float originY)
           
 void setDashPattern(float[] dashArray, float dashPhase)
           
 void setFont(org.axsl.pdf.PdfFont newFont, float newFontSize)
           
 void setHorizontalScaling(float newHorizontalScaling)
           
 void setLeading(float newLeading)
           
 void setLineCapStyle(org.axsl.pdf.PdfLineCapStyle newLineCapStyle)
           
 void setLineWidth(float width)
           
 void setTextKnockout(boolean newTextKnockout)
           
 void setTextRenderingMode(org.axsl.pdf.PdfTextRenderingMode newTextRenderingMode)
           
 void setTextRise(float newTextRise)
           
 void setWordSpacing(float newWordSpacing)
           
protected  String specialStreamDictEntries()
          Subclasses return any specialized dictionary entries here, so that they are included when writing the stream dictionary.
 
Methods inherited from class org.foray.pdf.object.PDFStream
add, addDefaultFilters, addEncryption, addFilter, addFilter, applyFilters, getDataLength, getOutputStream, output, outputStreamData, setData, setOutputStream, toPDF
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFContentStream

public PDFContentStream(PDFDocument doc)
Create a PDFContentStream.

Parameters:
doc - The parent PDF document.
Method Detail

close

public void close()
           throws org.axsl.pdf.PdfException
Specified by:
close in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

openTextObject

public void openTextObject()
                    throws org.axsl.pdf.PdfException
Makes the stream ready to accept text manipulation operators.

Throws:
org.axsl.pdf.PdfException - For errors writing the content.

closeTextObject

public void closeTextObject()
                     throws org.axsl.pdf.PdfException
Closes any open text object.

Throws:
org.axsl.pdf.PdfException - For errors writing the content.

setCursor

public void setCursor(float originX,
                      float originY)
               throws org.axsl.pdf.PdfException
Specified by:
setCursor in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

drawText

public void drawText(CharSequence text,
                     org.axsl.font.FontOptions fontOptions,
                     org.axsl.common.i18n.Orthography orthography)
              throws org.axsl.pdf.PdfException
Specified by:
drawText in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setFont

public void setFont(org.axsl.pdf.PdfFont newFont,
                    float newFontSize)
             throws org.axsl.pdf.PdfException
Specified by:
setFont in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setColor

public void setColor(Color newColor,
                     boolean stroke)
              throws org.axsl.pdf.PdfException
Specified by:
setColor in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setWordSpacing

public void setWordSpacing(float newWordSpacing)
                    throws org.axsl.pdf.PdfException
Specified by:
setWordSpacing in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setCharacterSpacing

public void setCharacterSpacing(float newCharacterSpacing)
                         throws org.axsl.pdf.PdfException
Specified by:
setCharacterSpacing in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setHorizontalScaling

public void setHorizontalScaling(float newHorizontalScaling)
                          throws org.axsl.pdf.PdfException
Specified by:
setHorizontalScaling in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setLeading

public void setLeading(float newLeading)
                throws org.axsl.pdf.PdfException
Specified by:
setLeading in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setTextRenderingMode

public void setTextRenderingMode(org.axsl.pdf.PdfTextRenderingMode newTextRenderingMode)
                          throws org.axsl.pdf.PdfException
Specified by:
setTextRenderingMode in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setTextRise

public void setTextRise(float newTextRise)
                 throws org.axsl.pdf.PdfException
Specified by:
setTextRise in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setTextKnockout

public void setTextKnockout(boolean newTextKnockout)
Specified by:
setTextKnockout in interface org.axsl.pdf.PdfContentStream

setLineCapStyle

public void setLineCapStyle(org.axsl.pdf.PdfLineCapStyle newLineCapStyle)
                     throws org.axsl.pdf.PdfException
Specified by:
setLineCapStyle in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

drawLine

public void drawLine(Line2D.Float line)
              throws org.axsl.pdf.PdfException
Specified by:
drawLine in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

drawRectangle

public void drawRectangle(Rectangle2D.Float rectangle,
                          boolean stroke,
                          boolean fill)
                   throws org.axsl.pdf.PdfException
Specified by:
drawRectangle in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

drawGraphic

public void drawGraphic(org.axsl.graphic.Graphic image,
                        Rectangle2D.Float contentRectangle,
                        Rectangle2D.Float clipRectangle,
                        org.axsl.font.FontConsumer fontConsumer,
                        boolean strokeText)
                 throws org.axsl.pdf.PdfException
Specified by:
drawGraphic in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setLineWidth

public void setLineWidth(float width)
                  throws org.axsl.pdf.PdfException
Specified by:
setLineWidth in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

setDashPattern

public void setDashPattern(float[] dashArray,
                           float dashPhase)
                    throws org.axsl.pdf.PdfException
Specified by:
setDashPattern in interface org.axsl.pdf.PdfContentStream
Throws:
org.axsl.pdf.PdfException

finalizeStreamContent

protected void finalizeStreamContent()
Description copied from class: PDFStream
This method is an explicit opportunity for subclasses to finish writing whatever content may still need to be written to the stream before the dictionary and stream contents are written.

Specified by:
finalizeStreamContent in class PDFStream

specialStreamDictEntries

protected String specialStreamDictEntries()
Description copied from class: PDFStream
Subclasses return any specialized dictionary entries here, so that they are included when writing the stream dictionary.

Specified by:
specialStreamDictEntries in class PDFStream
Returns:
Any specialized dictionary entries.


Copyright © 2017. All rights reserved.