Hi, i’m trying to size dashboards for a pdf report. How do I convert px into cm?
Thanks,
Jack
Hi, i’m trying to size dashboards for a pdf report. How do I convert px into cm?
Thanks,
Jack
All our rendering is done at 96 dpi, and conversion from cm to inch is 2.54 cm per inch. If you look at the API there are some helper variables that will give you some hints.
dundas.print.PaperSize (enum of standard sizes)
dundas.print.PaperUnit (enum of dimension types, px or inch or mm)
dundas.print.PaperSettings (define paper width/height in various units)
The link that James posted should be very helpful knowing the 96dpi.
This might help you too.
We include a few of the A series paper sizes from ISO 216 as well as US paper sizes as selectable standard paper sizes. Regardless of what unit the paper size is defined in, we use a 0.5” margin (i.e. A series sizes will get 12.7mm margins). Their exact definition is in bold and highlighted in yellow. Custom can always be specified as well.
The total interior space available is always going to be the oriented paper size (i.e. switch width/height if you use Landscape), and the subtract the left/right margin values from that oriented width, and top/bottom margin from oriented height. He can take advantage of our code we have to get some of this easily. For example:
// US Paper Letter size, Inch units, 0.5” margin
var paperSettings = dundas.print.PaperSettings.fromSize(dundas.print.PaperSize.LETTER);
// Force 10mm margins
paperSettings.setMargins(10, dundas.print.PaperUnit.MILLIMETERS);
// Convert units to Pixel
paperSettings.toUnit(dundas.print.PaperUnit.PIXEL);
Then paperSettings.innerWidth / paperSettings.innerHeight will contain the working area available.