How to specify the Print Width & Height for JPG & PNG image formats in ASP.NET
Product WebClientPrint for ASP.NET Published 03/01/2016 Updated 12/12/2016 Author Neodynamic
Overview
WebClientPrint Processor (WCPP) is the client utility part of WebClientPrint for ASP.NET solution. This utility can print image files in JPG/JPEG & PNG formats without requiring nor using any additional software!
WebClientPrint Processor (v3.0+) supports a new feature which allows you to specify the X, Y position, the Print Width & Height as well as the Print Orientation values right into the File Name of the JPG/PNG image you want to print by using the following parameters:
PARAMETER NAME | DESCRIPTION | SAMPLE |
PX | It's the X print position (left to right) in INCH unit | PX=0.1 |
PY | It's the Y print position (top to bottom) in INCH unit | PY=0.1 |
PW | It's the Print Width in INCH unit | PW=3.5 |
PH | It's the Print Height in INCH unit | PH=2.25 |
PO | It's the Print Orientation, 'P' for Postrait and 'L' for Landscape | PO=P |
So supposing you want to print a jpg image file which name on disk is MyPicture.jpg and you want to print it at X,Y 0.1in, in a 4.25in x 3.50in size then the PrintFile instantiation should be written as follows:
VB
Dim myPrintFile As New PrintFile(context.Server.MapPath("~/images/MyPicture.jpg"), "MyPicture-PX=0.1-PY=0.1-PW=4.25-PH=3.50-PO=P.jpg")
C#
PrintFile myPrintFile = new PrintFile(context.Server.MapPath("~/images/MyPicture.jpg"), "MyPicture-PX=0.1-PY=0.1-PW=4.25-PH=3.50-PO=P.jpg");
By using JPG/PNG images at high dpi resolution (300 or above) you could print from text to pictures at high quality output. It's great alternative to other document formats like PDF or Word doc which requires Adobe Reader and MS Word respectively installed at the client machine. Of course, in these cases you should convert pdf or doc to a set of high quality images by using some another tools.