You can easily resize or scale a RenderImage to 50% by completing the following steps:
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 a new Render Image, replacing c1logo.png with your image name and location. Dim img As New C1.C1Preview.RenderImage img.Image = Image.FromFile("C:\c1logo.png") ' Scale the image to 50% of the available page width, the height of the image will scale automatically here. img.Width = "50%" ' Create the document. C1PrintDocument1.StartDoc() C1PrintDocument1.RenderBlock(img) C1PrintDocument1.EndDoc() End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void Form1_Load(object sender, EventArgs e) { // Create a new Render Image, replacing c1logo.png with your image name and location. C1.C1Preview.RenderImage img = new C1.C1Preview.RenderImage(); img.Image = Image.FromFile("C:\\c1logo.png"); // Scale the image to 50% of the available page width, the height of the image will scale automatically here. img.Width = "50%"; // Create the document. c1PrintDocument1.StartDoc(); c1PrintDocument1.RenderBlock(img); c1PrintDocument1.EndDoc(); } |
A image appears scaled on the page: