Posted by a ceTe Software moderator
Hello,
You can change the display values as per your business needs by getting the dimension of the page dynamically (which will be returned as pixels) and then converting them to the desired units. Below is the code sample for it. You will need to do this in view changed and document displayed events of DynamicPDF Viewer control.
string temp = string.Empty;
string imageSizeLabel = "ImageSizeLabel";
private void pdfViewer1_ViewChanged(object sender, ViewChangedEventArgs e)
{
//For changing the PDF dimension label text (which is at left botton corner of the Viewer).
ceTe.DynamicPDF.Viewer.View view = pdfViewer1.GetCurrentView();
PageVisibleArea[] VisibleAreas = pdfViewer1.GetPageVisibleArea(view);
System.Drawing.Rectangle rect = System.Drawing.Rectangle.FromLTRB((int)VisibleAreas[0].PixelLeft, (int)VisibleAreas[0].PixelTop, (int)VisibleAreas[0].PixelRight, (int)VisibleAreas[0].PixelBottom);
float width = (float)Math.Round((rect.Width * 0.75F) / (pdfViewer1.ZoomPercent * 72), 2);
float height = (float)Math.Round((rect.Height * 0.75F) / (pdfViewer1.ZoomPercent * 72), 2);
float widthInCentimeter = width * 2.54F;
float heightInCentimeter = height * 2.54F;
int pagenumber = VisibleAreas[0].PageNumber;
temp = widthInCentimeter + "x" + heightInCentimeter + " cm";
pdfViewer1.Controls[imageSizeLabel].Text = temp;
}
In the upcoming version (v2.0) of the Viewer we have exposed this functionality as a property so you can just change the unit of measure easily by setting a single property. The beta download of v2.0 is available at
here in case you would like to try.
It is not possible to change the language of the Viewer control, it is available in English only. Support for different localizations is in our feature request list but at this point we don’t have an exact timeframe on when that feature will be available.
Thanks,
ceTe Software Support Team.