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

PDFViewer ScaleFactor

1 Answer 468 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Tarik
Top achievements
Rank 1
Tarik asked on 07 Sep 2015, 10:06 PM

Hi,

 I am trying integrating a rad PDFViewer which show a pdf generated in a Stream to print it, at first, i would like to show the pdf document with a scalefactor of 0.5 and give the user the possibility to increase or decrease the zoom. In way to perform that, i added a RadSlider and bound the scalefactor of the pdf viewer with the value of the rad slider like show the code below (The problem i encounter is that the scalefactor is initially set to 1, however the pdf viewer width allow to show the 0.5 scale value) : 

<telerik:RadPdfViewer x:Name="pdfViewer"
                      Grid.Row="1"
                      Width="450"
                      DocumentSource="{Binding Document,
                                               Mode=TwoWay}"
                      ScaleFactor="{Binding ElementName=ZoomSlider,
                                            Path=Value,
                                            Mode=TwoWay,
                                            UpdateSourceTrigger=PropertyChanged}"
                      ScaleMode="FitToWidth"
                      ScrollViewer.VerticalScrollBarVisibility="Auto" />

Then the code of the RadSlider:

<telerik:RadSlider x:Name="ZoomSlider"
                   Grid.Column="0"
                   Width="300"
                   HorizontalAlignment="Center"
                   HandlesVisibility="Visible"
                   Maximum="1.5"
                   Value="0.5"
                   Minimum="0"
                   TickFrequency="0.25"
                   TickPlacement="TopLeft">
    <telerik:RadSlider.TickTemplate>
        <DataTemplate>
            <Grid>
                <TextBlock Text="{Binding}" />
            </Grid>
        </DataTemplate>
    </telerik:RadSlider.TickTemplate>
</telerik:RadSlider>

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Demirev
Telerik team
answered on 10 Sep 2015, 08:25 AM
Hi Tarik,

When the document of the RadPdfViewer is changed the ScaleFactor is set to the default scale factor value of 1. If you want the initial scale factor to be 0.5 you could attach to DocumentChanged event of the RadPdfViewer and change it after setting its document.

Another approach is to bind the scale factor using your ViewModel and after setting the Document property of the view model to set the ScaleFactor property to 0.5.

I hope this helps.

Regards,
Nikolay Demirev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PDFViewer
Asked by
Tarik
Top achievements
Rank 1
Answers by
Nikolay Demirev
Telerik team
Share this question
or