public class PdfDevice extends Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
Represents rendering to a pdf document.
Modifier and Type | Class and Description |
---|---|
static class |
PdfDevice.PdfGraphicContext
Holds current graphics control parameters for the PdfDevice.
|
Device.DeviceConfiguration, Device.PageWritingStrategy
Constructor and Description |
---|
PdfDevice(ICreateStreamProvider streamProvider)
Initializes a new instance of the
PdfDevice class. |
PdfDevice(OutputStream outputStream)
Initializes a new instance of the
PdfDevice class. |
PdfDevice(PdfRenderingOptions options,
ICreateStreamProvider streamProvider)
Initializes a new instance of the
PdfDevice class by rendering options and stream provider. |
PdfDevice(PdfRenderingOptions options,
OutputStream outputStream)
Initializes a new instance of the
PdfDevice class by rendering options and output stream. |
PdfDevice(PdfRenderingOptions options,
com.aspose.html.internal.ms.System.IO.Stream stream)
Initializes a new instance of the
PdfDevice class by rendering options and output stream. |
PdfDevice(PdfRenderingOptions options,
String file)
Initializes a new instance of the
PdfDevice class by rendering options and output file name. |
PdfDevice(com.aspose.html.internal.ms.System.IO.Stream stream)
Initializes a new instance of the
PdfDevice class. |
PdfDevice(String file)
Initializes a new instance of the
PdfDevice class. |
Modifier and Type | Method and Description |
---|---|
void |
addRect(com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Appends a rectangle to the current path as a complete subpath.
|
void |
beginDocument(Document document)
Begins rendering of the document.
|
boolean |
beginElement(Element element,
com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Begins rendering of the html element.
|
void |
beginPage(com.aspose.html.internal.ms.System.Drawing.SizeF size)
Begins rendering of the new page.
|
void |
clearExtGraphicState() |
void |
clip(int mode)
Modifies the current clipping path by intersecting it with the current path, using the FillMode rule to determine the region to fill.
|
void |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.
|
void |
cubicBezierTo(com.aspose.html.internal.ms.System.Drawing.PointF pt1,
com.aspose.html.internal.ms.System.Drawing.PointF pt2,
com.aspose.html.internal.ms.System.Drawing.PointF pt3)
Appends a cubic Bézier curve to the current path.
|
void |
drawImage(byte[] data,
int type,
com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Draws the specified image.
|
void |
endDocument()
Ends rendering of the document.
|
void |
endElement(Element element)
Ends rendering of the html element.
|
void |
endPage()
Ends rendering of the current page.
|
void |
fill(int mode)
Fills the entire region enclosed by the current path.
|
void |
fillText(String text,
com.aspose.html.internal.ms.System.Drawing.PointF pt)
Fills the specified text string at the specified location.
|
void |
flush()
Flushes all data to output stream.
|
void |
lineTo(com.aspose.html.internal.ms.System.Drawing.PointF pt)
Appends a straight line segment from the current point to the point (pt).
|
void |
moveTo(com.aspose.html.internal.ms.System.Drawing.PointF pt)
Begins a new subpath by moving the current point to coordinates of the parameter pt, omitting any connecting line segment.
|
void |
restoreGraphicContext()
Restores the entire graphics context to its former value by popping it from the stack.
|
void |
saveGraphicContext()
Pushes a copy of the entire graphics context onto the stack.
|
void |
setExtGraphicState() |
void |
stroke()
Strokes a line along the current path.
|
void |
strokeAndFill(int mode)
Strokes and fill current path.
|
void |
strokeText(String text,
com.aspose.html.internal.ms.System.Drawing.PointF pt)
Strokes the specified text string at the specified location.
|
dispose, getCurrentDocument, getGraphicContext, getOptions, getOriginalOutputStream, getPageIndex, getRenderingStarted, initPageBackground, setCurrentDocument, setPageIndex
public PdfDevice(ICreateStreamProvider streamProvider)
Initializes a new instance of the PdfDevice
class.
streamProvider
- The stream provider.public PdfDevice(PdfRenderingOptions options, ICreateStreamProvider streamProvider)
Initializes a new instance of the PdfDevice
class by rendering options and stream provider.
options
- Rendering options.streamProvider
- Object that implements the ICreateStreamProvider
interfacepublic PdfDevice(String file)
Initializes a new instance of the PdfDevice
class.
file
- The output file name.public PdfDevice(PdfRenderingOptions options, String file)
Initializes a new instance of the PdfDevice
class by rendering options and output file name.
options
- Rendering options.file
- The output file name.public PdfDevice(com.aspose.html.internal.ms.System.IO.Stream stream)
Initializes a new instance of the PdfDevice
class.
stream
- The stream.public PdfDevice(OutputStream outputStream)
Initializes a new instance of the PdfDevice
class.
outputStream
- The java.io.OutputStream.public PdfDevice(PdfRenderingOptions options, com.aspose.html.internal.ms.System.IO.Stream stream)
Initializes a new instance of the PdfDevice
class by rendering options and output stream.
options
- Rendering options.stream
- The output stream.public PdfDevice(PdfRenderingOptions options, OutputStream outputStream)
Initializes a new instance of the PdfDevice
class by rendering options and output stream.
options
- Rendering options.outputStream
- The java.io.OutputStream.public void saveGraphicContext()
Pushes a copy of the entire graphics context onto the stack.
saveGraphicContext
in interface IDevice
saveGraphicContext
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void restoreGraphicContext()
Restores the entire graphics context to its former value by popping it from the stack.
restoreGraphicContext
in interface IDevice
restoreGraphicContext
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void addRect(com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Appends a rectangle to the current path as a complete subpath.
addRect
in interface IDevice
addRect
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
rect
- A rectangle to draw.public void beginDocument(Document document)
Begins rendering of the document.
beginDocument
in interface IDevice
beginDocument
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
document
- The document.public boolean beginElement(Element element, com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Begins rendering of the html element.
beginElement
in interface IDevice
beginElement
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
element
- The html element.rect
- Bounding box of the node.public void beginPage(com.aspose.html.internal.ms.System.Drawing.SizeF size)
Begins rendering of the new page.
beginPage
in interface IDevice
beginPage
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
size
- Size of the page.public void clip(int mode)
Modifies the current clipping path by intersecting it with the current path, using the FillMode rule to determine the region to fill. This method terminates current path.
clip
in interface IDevice
clip
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
mode
- Filling mode specifies how the interior of a closed path is clippedpublic void closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. If the current subpath is already closed, "ClosePath" does nothing. This operator terminates the current subpath. Appending another segment to the current path begins a new subpath, even if the new segment begins at the endpoint reached by the "ClosePath" method.
closePath
in interface IDevice
closePath
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void cubicBezierTo(com.aspose.html.internal.ms.System.Drawing.PointF pt1, com.aspose.html.internal.ms.System.Drawing.PointF pt2, com.aspose.html.internal.ms.System.Drawing.PointF pt3)
Appends a cubic Bézier curve to the current path. The curve extends from the current point to the point pt2, using pt1 and pt2 as the Bézier control points. The new current point is pt3.
cubicBezierTo
in interface IDevice
cubicBezierTo
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
pt1
- Coordinates of first pointpt2
- Coordinates of second pointpt3
- Coordinates of third pointpublic void drawImage(byte[] data, int type, com.aspose.html.internal.ms.System.Drawing.RectangleF rect)
Draws the specified image.
drawImage
in interface IDevice
drawImage
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
data
- An array of bytes representing the image.type
- Image type.rect
- A rectangel which determines position and size to draw.public void endDocument()
Ends rendering of the document.
endDocument
in interface IDevice
endDocument
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void flush()
Flushes all data to output stream.
flush
in interface IDevice
flush
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void endElement(Element element)
Ends rendering of the html element.
endElement
in interface IDevice
endElement
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
element
- The html element.public void endPage()
Ends rendering of the current page.
endPage
in interface IDevice
endPage
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void fill(int mode)
Fills the entire region enclosed by the current path. If the path consists of several disconnected subpaths, it fills the insides of all subpaths, considered together. This method terminates current path.
fill
in interface IDevice
fill
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
mode
- Filling mode specifies how the interior of a closed path is filledpublic void fillText(String text, com.aspose.html.internal.ms.System.Drawing.PointF pt)
Fills the specified text string at the specified location.
fillText
in interface IDevice
fillText
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
text
- String to fill.pt
- Point that specifies the coordinates of the text.public void lineTo(com.aspose.html.internal.ms.System.Drawing.PointF pt)
Appends a straight line segment from the current point to the point (pt). The new current point is pt.
lineTo
in interface IDevice
lineTo
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
pt
- Point of where to create the line to.public void moveTo(com.aspose.html.internal.ms.System.Drawing.PointF pt)
Begins a new subpath by moving the current point to coordinates of the parameter pt, omitting any connecting line segment. If the previous path construction method in the current path was also "MoveTo", the new "MoveTo" overrides it; no vestige of the previous "MoveTo" operation remains in the path.
moveTo
in interface IDevice
moveTo
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
pt
- Point of where to move the path to.public void stroke()
Strokes a line along the current path. The stroked line follows each straight or curved segment in the path, centered on the segment with sides parallel to it. Each of the path’s subpaths is treated separately. This method terminates current path.
stroke
in interface IDevice
stroke
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
public void strokeAndFill(int mode)
Strokes and fill current path. This method terminates current path.
strokeAndFill
in interface IDevice
strokeAndFill
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
mode
- Filling mode specifies how the interior of a closed path is filled.public void strokeText(String text, com.aspose.html.internal.ms.System.Drawing.PointF pt)
Strokes the specified text string at the specified location.
strokeText
in interface IDevice
strokeText
in class Device<PdfDevice.PdfGraphicContext,PdfRenderingOptions>
text
- String to stroke.pt
- Point that specifies the coordinates where to start the text.public void setExtGraphicState()
public void clearExtGraphicState()