To set the page size for the document, use the Watermark property.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Imports C1.C1Preview |
To write code in C#
C# |
Copy Code
|
---|---|
using C1.C1Preview; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create watermark and layout. Dim waterMark As New RenderImage Dim pl As New C1.C1Preview.PageLayout() ' Set the watermark image; replace c1logo.png with your image's name. waterMark.Image = Image.FromFile("c:\c1logo.png") waterMark.Y = New Unit(2, UnitTypeEnum.Inch) pl.Watermark = waterMark Me.C1PrintDocument1.PageLayout = pl ' Generate the document. Me.C1PrintDocument1.Generate() End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void Form1_Load(object sender, EventArgs e) { // Create watermark and layout. RenderImage waterMark = new RenderImage(); C1.C1Preview.PageLayout pl = new C1.C1Preview.PageLayout(); // Set the watermark image; replace c1logo.png with your image's name. waterMark.Image = Image.FromFile("c:\\c1logo.png"); waterMark.Y = new Unit(2, UnitTypeEnum.Inch); pl.Watermark = waterMark; this.c1PrintDocument1.PageLayout = pl; // Generate the document. this.c1PrintDocument1.Generate(); } |
A watermark is added to the page: