Table of Contents

Class Snippet

Namespace
PdfSharp.Quality
Assembly
PdfSharp.Quality-gdi.dll

Base class of code snippets for testing.

public abstract class Snippet : FeatureAndSnippetBase
Inheritance
Snippet
Derived
Inherited Members

Constructors

Snippet()

Initializes a new instance of the Snippet class.

protected Snippet()

Properties

BoxOption

Gets or sets the box option.

protected FeatureAndSnippetBase.BoxOptions BoxOption { get; set; }

Property Value

FeatureAndSnippetBase.BoxOptions

Cleanroom

Gets or sets a value indicating how this Snippet is drawn. If it is true, all describing graphics like title and boxes are omitted. Use this option to produce a clean PDF for debugging purposes. If it is false, all describing graphics like title and boxes are drawn. This is the regular case.

public bool Cleanroom { get; set; }

Property Value

bool

FontHeader

Gets the header font in snippets.

public XFont FontHeader { get; }

Property Value

XFont

FontNameStd

The standard font name used in snippet.

public static string FontNameStd { get; }

Property Value

string

FontStd

Gets the standard font in snippets.

public XFont FontStd { get; }

Property Value

XFont

NoGraphic

Gets or sets a value indicating whether all graphics output is omitted.

public bool NoGraphic { get; set; }

Property Value

bool

NoText

Gets or sets a value indicating whether all text output is omitted.

public bool NoText { get; set; }

Property Value

bool

PathName

Gets or sets the path or name where to store the PDF file.

public string PathName { get; set; }

Property Value

string

Pentagram

Gets the points of a pentagram in a unit circle.

protected static XPoint[] Pentagram { get; }

Property Value

XPoint[]

RectBox

Gets the rectangle of a box.

protected static XRect RectBox { get; }

Property Value

XRect

Title

Gets or sets the title of the snipped

public string Title { get; set; }

Property Value

string

Methods

BeginBox(XGraphics, int)

Begins rendering the content of a box.

protected void BeginBox(XGraphics gfx, int boxNumber)

Parameters

gfx XGraphics

The XGraphics object.

boxNumber int

The box number.

BeginBox(XGraphics, int, BoxOptions)

Begins rendering the content of a box.

protected void BeginBox(XGraphics gfx, int boxNumber, FeatureAndSnippetBase.BoxOptions options)

Parameters

gfx XGraphics

The XGraphics object.

boxNumber int

The box number.

options FeatureAndSnippetBase.BoxOptions

The box options.

BeginBox(XGraphics, int, BoxOptions, string?)

Translates origin of coordinate space to a box of size 220pp x 140pp.

protected void BeginBox(XGraphics gfx, int n, FeatureAndSnippetBase.BoxOptions options, string? description)

Parameters

gfx XGraphics
n int
options FeatureAndSnippetBase.BoxOptions
description string

CreatePdfPage(PdfDocument)

Creates a PDF page for the specified document.

public PdfPage CreatePdfPage(PdfDocument doc)

Parameters

doc PdfDocument

The document.

Returns

PdfPage

DrawAlignmentGrid(XGraphics, bool, bool)

Draws the alignment grid.

protected static void DrawAlignmentGrid(XGraphics gfx, bool highlightHorizontal = false, bool highlightVertical = false)

Parameters

gfx XGraphics

The XGraphics object.

highlightHorizontal bool

if set to true [highlight horizontal].

highlightVertical bool

if set to true [highlight vertical].

DrawArtBox(XGraphics)

Draws a dotted line showing the art box.

protected void DrawArtBox(XGraphics gfx)

Parameters

gfx XGraphics

The XGraphics object.

DrawCenterPoint(XGraphics)

Draws the center point of a box.

protected static void DrawCenterPoint(XGraphics gfx)

Parameters

gfx XGraphics

The XGraphics object.

DrawHeader(XGraphics, string)

Draws the header.

public void DrawHeader(XGraphics gfx, string renderTarget)

Parameters

gfx XGraphics
renderTarget string

DrawHeader(string)

Draws the header.

public void DrawHeader(string renderTarget)

Parameters

renderTarget string

DrawNotSupportedFeature(XGraphics)

Draws a text that states that a feature is not supported in a particular build.

protected void DrawNotSupportedFeature(XGraphics gfx)

Parameters

gfx XGraphics

DrawPdfHeader()

Draws the header for a PDF document.

public void DrawPdfHeader()

DrawPngHeader()

Draws the header for a PNG image.

public void DrawPngHeader()

DrawTiledBox(XGraphics, double, double, double, double, double)

Draws a tiled box.

protected void DrawTiledBox(XGraphics gfx, double x, double y, double width, double height, double delta)

Parameters

gfx XGraphics

The XGraphics object.

x double

The left position of the box.

y double

The top position of the box.

width double

The width of the box.

height double

The height of the box.

delta double

The size of the grid square.

EndBox(XGraphics)

Ends rendering of the current box.

protected void EndBox(XGraphics gfx)

Parameters

gfx XGraphics

The XGraphics object.

GetPentagram(double, XPoint)

Gets the points of a pentagram relative to a center and scaled by a size factor.

protected static XPoint[] GetPentagram(double size, XPoint center)

Parameters

size double

The scaling factor of the pentagram.

center XPoint

The center of the pentagram.

Returns

XPoint[]

GfxForLastPage(PdfDocument)

Gets a XGraphics object for the last page of the specified document.

public static XGraphics GfxForLastPage(PdfDocument doc)

Parameters

doc PdfDocument

The PDF document.

Returns

XGraphics

HelloWorldFactory(string?, bool)

Creates a HelloWorld document, optionally with custom message.

public static PdfDocument HelloWorldFactory(string? message = null, bool unicode = false)

Parameters

message string
unicode bool

Returns

PdfDocument

RenderSnippet()

When implemented in a derived class renders the snippet in an XGraphic object.

public void RenderSnippet()

RenderSnippet(XGraphics)

When implemented in a derived class renders the snippet in the specified XGraphic object.

public abstract void RenderSnippet(XGraphics gfx)

Parameters

gfx XGraphics

The XGraphics where to render the snippet.

RenderSnippetAsPdf()

Renders a snippet as PDF document.

public void RenderSnippetAsPdf()

RenderSnippetAsPdf(XUnit, XUnit, XGraphicsUnit, XPageDirection)

Renders a snippet as PDF document.

public void RenderSnippetAsPdf(XUnit width, XUnit height, XGraphicsUnit graphicsUnit, XPageDirection pageDirection)

Parameters

width XUnit
height XUnit
graphicsUnit XGraphicsUnit
pageDirection XPageDirection

RenderSnippetAsPng()

Renders a snippet as PNG image.

public void RenderSnippetAsPng()