TX Text Control .NET for WPF

GetImage Method

Method|Introduced in 15.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets an image of the page's contents.

Syntax

GetImage(Page.PageContent)

Gets an image of the page's contents as an enhanced metafile.

public Metafile GetImage(Page.PageContent contents);
ParameterDescription
contents

Specifies the image's contents. It can be one or more of the values of the PageContent enumeration.

GetImage(int, Page.PageContent)

Gets an image of the page's contents as a bitmap in screen resolution.

public Bitmap GetImage(int zoomFactor, Page.PageContent contents);
ParameterDescription
zoomFactor

Specifies a zooming factor in percent.

contents

Specifies the image's contents. It can be one or more of the values of the PageContent enumeration.

GetImage(Page.PageContent, int)

Gets an image of the page's contents as a string in Scalable Vector Graphics (SVG) format. All characters are contained with outline curve data that are cubic Bézier splines. Curve and line data coordinates are in twentieth of a point (twips). Images of all pixel-formats are embedded in Portable Network Graphics (PNG) format.

public string GetImage(Page.PageContent contents, int iMaxImageResolution);
ParameterDescription
contents

Specifies the image's contents. It can be one or more of the values of the PageContent enumeration.

iMaxImageResolution

Specifies a maximum resolution value, in dots per inch, for images in pixel-formats. All of these images are embedded in Portable Network Graphics (PNG) format.

Examples

The following example works with the first laid-out page of a short report by using Page.GetImage.

textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Page page = textControl.GetPages()[1];

var result = page.GetImage(Page.PageContent.Background, 10);
Console.WriteLine($"Get Image result: {result}");

page.Select();

Remarks

When an SVG is added to the TextControl's ImageCollection, its original content is embedded unchanged in the SVG created with the GetImage method. This includes all script data that was part of the added SVG image.