Class PsDocument

PsDocument class

This class encapsulates PS/EPS documents.

public sealed class PsDocument : Document

Constructors

NameDescription
PsDocument(Stream)Initializes PsDocument with a stream of PS/EPS file.
PsDocument(string)Initializes PsDocument with an input PS/EPS file.
PsDocument(Stream, PsSaveOptions)Initializes empty PsDocument with initialized page.
PsDocument(string, PsSaveOptions)Initializes empty PsDocument with initialized page.
PsDocument(Stream, PsSaveOptions, bool)Initializes empty PsDocument.
PsDocument(Stream, PsSaveOptions, int)Initializes empty PsDocument when the number of Postscript document pages is known in advance.
PsDocument(string, PsSaveOptions, bool)Initializes empty PsDocument.
PsDocument(string, PsSaveOptions, int)Initializes empty PsDocument when the number of Postscript document pages is known in advance.

Properties

NameDescription
InputStream { get; set; }Gets or sets an input stream of PS/EPS file.
NumberOfPages { get; }Returns the number of pages in resulting PDF document.

Methods

NameDescription
Clip(GraphicsPath)Adds clip to current graphics state.
ClipAndNewPath(GraphicsPath)Adds clip to current graphics state and than writes “newpath” operator. It is necessary to do to escape of confluence of this clipping path and some subsequent pathes such as glyphs outlined with “charpath” operator.
ClipRectangle(RectangleF)Adds clipping rectangle to current graphics state.
ClipText(string, Font, float, float)Adds clip from an outline of given text in given font.
ClosePage()Complete current page.
CropEps(Stream, float[])Crops given PsDocument as EPS file. It saves initial EPS file with updated existing %%BoundingBox or new one will be created.
CropEps(string, float[])Crops given PsDocument as EPS file. It saves initial EPS file with updated existing %%BoundingBox or new one will be created.
Draw(GraphicsPath)Draw an arbitrary path.
DrawArc(double, double, double, double, double, double)Draws an arc.
DrawExplicitImageMask(Bitmap, Bitmap, Matrix)Draw masked image.
DrawImage(Bitmap)Draw image.
DrawImage(Bitmap, Matrix, Color)Draw transformed image with background.
DrawLine(double, double, double, double)Draws a line segment.
DrawOval(double, double, double, double)Draws an oval.
DrawPolygon(double[], double[], int)Draws a poligone.
DrawPolygon(int[], int[], int)Draws a polygon.
DrawPolyline(double[], double[], int)Draws a polyline.
DrawPolyline(int[], int[], int)Draws a polyline.
DrawRect(double, double, double, double)Draws a rectangle.
DrawRoundRect(double, double, double, double, double, double)Draws a round rectangle.
DrawTransparentImage(Bitmap, Matrix, int)Draw transformed transparent image. If image doesn’t have Alpha channel it will be drawn as opaque image
ExtractEpsBoundingBox()Reads EPS file and extracts bounding box of EPS image from %%BoundingBox comment or bounds for default page size (0, 0, 595, 842) if it doesn’t exist.
ExtractEpsSize()Reads EPS file and extracts a size of EPS image from %%BoundingBox comment or default page size (595, 842) if it doesn’t exist.
ExtractText(SaveOptions, int, int)Extract text from PS file. The text can be extracted only if it is written with Type 42 (TrueType) font or Type 0 font with Type 42 fonts in its Vector Map.
Fill(GraphicsPath)Fill an arbitrary path.
FillAndStrokeText(string, DrFont, float, float, Brush, Pen)Adds a text string by filling interrior of glyphs and drawing glyphs contours.
FillAndStrokeText(string, Font, float, float, Brush, Pen)Adds a text string by filling interrior of glyphs and drawing glyphs contours.
FillAndStrokeText(string, float[], DrFont, float, float, Brush, Pen)Adds a text string by filling interrior of glyphs and drawing glyphs contours.
FillAndStrokeText(string, float[], Font, float, float, Brush, Pen)Adds a text string by filling interrior of glyphs and drawing glyphs contours.
FillArc(double, double, double, double, double, double)Fills an arc.
FillOval(double, double, double, double)Fills an oval.
FillPolygon(double[], double[], int)Fills a poligone.
FillPolygon(int[], int[], int)Fills a poligone.
FillRect(double, double, double, double)Fills a rectangle.
FillRoundRect(double, double, double, double, double, double)Fills a round rectangle.
FillText(string, DrFont, float, float)Adds a text string by filling interrior of glyphs.
FillText(string, Font, float, float)Adds a text string by filling interrior of glyphs.
FillText(string, DrFont, float, float, Brush)Adds a text string by filling interrior of glyphs.
FillText(string, float[], DrFont, float, float)Adds a text string by filling interrior of glyphs.
FillText(string, float[], Font, float, float)Adds a text string by filling interrior of glyphs.
FillText(string, Font, float, float, Brush)Adds a text string by filling interrior of glyphs.
FillText(string, float[], DrFont, float, float, Brush)Adds a text string by filling interrior of glyphs.
FillText(string, float[], Font, float, float, Brush)Adds a text string by filling interrior of glyphs.
GetPaint()Gets paint of current graphics state.
GetStroke()Gets stroke of current graphics state.
GetXmpMetadata()Reads PS/EPS file and extracts XmpMetdata if it already exists or add new one if it doesn’t exist.
MergeToPdf(Stream, string[], SaveOptions)Merges PS/EPS files to a device.
MergeToPdf(string, string[], SaveOptions)Merges PS/EPS files to a device.
OpenPage(string)Creates new page with document’s size and make it current one.
OpenPage(float, float)Creates new page and make it current one.
OutlineText(string, DrFont, float, float)Adds a text string by drawing glyphs contours.
OutlineText(string, Font, float, float)Adds a text string by drawing glyphs contours.
OutlineText(string, DrFont, float, float, Pen)Adds a text string by drawing glyphs contours.
OutlineText(string, float[], DrFont, float, float)Adds a text string by drawing glyphs contours.
OutlineText(string, float[], Font, float, float)Adds a text string by drawing glyphs contours.
OutlineText(string, Font, float, float, Pen)Adds a text string by drawing glyphs contours.
OutlineText(string, float[], DrFont, float, float, Pen)Adds a text string by drawing glyphs contours.
OutlineText(string, float[], Font, float, float, Pen)Adds a text string by drawing glyphs contours.
ResizeEps(Stream, SizeF, Units)Resizes given PsDocument as EPS file. This method is used only after extracting EPS size. It saves initial EPS file with updated existing %%BoundingBox or new one will be created. Page transformation matrix also will be set.
ResizeEps(string, SizeF, Units)Resizes given PsDocument as EPS file. This method is used only after extracting EPS size. It saves initial EPS file with updated existing %%BoundingBox or new one will be created. Page transformation matrix also will be set.
Rotate(float)Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
Rotate(int)Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
Save()Saves given PsDocument as EPS file. This method is used only when PsDocument was created from scratch.
Save(Stream)Saves given PsDocument as EPS file. This method is used only after updating XMP metadata. It saves initial EPS file with updated existing metadata or new one created while calling GetMetadata method. In the last case all necessary PostScript code and EPS comments are added.
SaveAsImage(ImageSaveOptions)Saves PS/EPS file to images bytes arrays.
SaveAsPdf(Stream, PdfSaveOptions)Saves PS/EPS file to PDF stream.
SaveAsPdf(string, PdfSaveOptions)Saves PS/EPS file to PDF file.
Scale(float, float)Adds scale to current graphics state (scale current matrix).
SetPageDevice(Dictionary<string, object>)Sets page device parameters (see operator “setpagedevice” PostScript spesification). Among these can be page size and color etc.
SetPageSize(float, float)Sets page size. To create pages with different sizes in one document use SetPageDevice method just after this method.
SetPaint(Brush)Sets paint in current graphics state.
SetStroke(Pen)Sets stroke in current graphics state.
SetTransform(Matrix)Set current transformation to this one.
Shear(float, float)Adds shear transformation to current graphics state (shear current matrix).
Transform(Matrix)Adds transformation to current graphics state (concatenates this matrix with current one).
Translate(float, float)Adds translation to current graphics state (translates current matrix).
WriteGraphicsRestore()Writes restoring of the current graphics state (See PostScript specification on operator “grestore”).
WriteGraphicsSave()Writes saving of the current graphics state (See PostScript specification on operator “gsave”).
static SaveImageAsEps(Bitmap, Stream, PsSaveOptions)Saves Bitmap object to EPS output stream.
static SaveImageAsEps(Bitmap, string, PsSaveOptions)Saves Bitmap object to EPS file.
static SaveImageAsEps(Stream, Stream, PsSaveOptions)Saves PNG/JPEG/TIFF/BMP/GIF/EMF image from input stream to EPS output stream.
static SaveImageAsEps(string, string, PsSaveOptions)Saves PNG/JPEG/TIFF/BMP/GIF/EMF image from file to EPS file.

See Also