This is a migrated thread and some comments may be shown as answers.

Setting ScaleFactor by code

3 Answers 129 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 03 Nov 2014, 09:04 PM
Hi,

I'm using Telerik V2014.2.729.40 and I created a UserControl which contain only a PdfViewer. In my UserControl I have many methods to manipulate the PDF (ie: Print, GotoPage, PageUp, PageDown, FirstPage, LastPage, etc...). One of my method is to add scalling to the PDF (ie: 10%, 25%, 50%, 75%, 100%, 150%, 200%, 500%, 1000% and 2000%). I would like to know how I can bind the value passed to my ScaleFactor (string pScale) to the PDFViewer.

Thank's
Alain

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 04 Nov 2014, 01:53 PM
Hello Alain,

Thank you for contacting us.

You may use the PercentComboBox control which can be found in Telerik.Windows.Controls.FixedDocumentViewersUI namespace. You may see how to bind this control to the PdfViewer on this link to github SDK example. The PercentComboBox control may be seen as well in our FirstLook online demo.

I hope this is helpful. If you have any additional questions or concerns please do not hesitate to contact us again.

Regards,
Deyan
the Telerik team
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Christie Admin
Top achievements
Rank 1
answered on 04 Nov 2014, 02:44 PM
Hi Deyan,

the problem is in my UserControl I don't have any control which offer a scaling value, my usercontrol have the contract to only display a document and I expose multiple public functions to manipulate the pdfdocument. The application itself doesn't know that my usercontrol use any Telerik controls so in the application, the developpers use a standard combobox and when the user change the value of the combobox, the application call my public function ScaleDocument(double pScaleValue).

Thank's

Alain
0
Deyan
Telerik team
answered on 06 Nov 2014, 01:24 PM
Hello Alain,

You can create ScaleFactor dependency property for your user control which internally bounds to the RadPdfViewer's ScaleFactor depencency property. This way the application can be bound to the new dependency property without having to know about Telerik's control internal existance.

I am attaching a sample project showing how to achieve the described above. A few words about this project:
  • There is PdfViewerUserControl which has a RadPdfViewer in it.
  • In code behind of this user control a new ScaleFactor dependency property is registered. 
  • In XAML the PdfViewerUserControl's ScaleFactor property in bounded to the child RadPdfViewer's dependency property.
  • In MainWindow.xaml the user control is used and a textbox has its text property bounded to the ScaleFactor dependency property.
  • Either by holding control and scrolling with the mouse wheel, or by using the "Zoom in" and "Zoom out" buttons you may change the ScaleFactor and this results in updating the text in the textbox.

I hope this helps. If you have any other questions or concerns do not hesitate to contact us again.

Regards,
Deyan
the Telerik team
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PDFViewer
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Christie Admin
Top achievements
Rank 1
Share this question
or