We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Creating a page of arbitrary inch size and filling with an image?

Thread ID:





73331 May 1,2008 08:46 PM UTC May 5,2008 08:17 AM UTC WinForms 1
Tags: PDF
Nils Benson
Asked On May 1, 2008 08:46 PM UTC

We have an application that generates data graphs. These graphs have a vertical scale that represents a depth, and the horizontal scale represents some data point value.

The vertical scale, when turned into PDF or printed needs to match a particular physical scale. That is we could have a scale that is 5":100' (five inches of paper/PDF vertical = 100 feet of depth in the chart vertical scale).

I am trying to figure out how to do this, but can't seem to get it.

The image has already been created to the right dimensions assuming 96 DPI (it is generated for the screen currently). I would like to generate a page that is of a given width (typically 8.5", but could be different) with a length that is appropriate for the image we're trying to place on it.

I guess I'm asking this: How can I create a page of arbitrary inch size and put an image on it to take up the entirety of the page??

Yavanaarasi G [Syncfusion]
Replied On May 5, 2008 08:17 AM UTC

Hi Nils,

Thank you for your interest in Syncfusion products.

Essential PDF images are rendered as points not as DPI. Images in Pixels/Inches can be converted to points and are then rendered into PDF as points.

Here is a code snippet:

PdfDocument pdfDoc = new PdfDocument();
PdfUnitConvertor con = new PdfUnitConvertor();

//converts inches to points
float height = con.ConvertUnits(718, PdfGraphicsUnit.Inch, PdfGraphicsUnit.Point);
float width = con.ConvertUnits(1048, PdfGraphicsUnit.Inch, PdfGraphicsUnit.Point);
PointF location = new PointF(0, 0);
SizeF pageSize = new SizeF(width, height);
PdfBitmap s=new PdfBitmap(Image.FromFile(path));
page.Graphics.DrawImage(s,location );

Here is a sample for your reference:


Please let me know if you have any other concerns.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon