Remove margins in RadPdfViewer

1 Answer 20 Views
PDFViewer
note prj
Top achievements
Rank 1
note prj asked on 10 Jun 2021, 01:42 PM
When you import a pdf file as shown in the attached picture, there is a blank space. (The blue part)
I was wondering if there is a setting to remove this margin.

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 14 Jun 2021, 10:20 AM

Hello,

This margin is controlled programmatically when changing something in the layout of RadPdfViewer. What you can do to hide the canvas behind the page is to modify the template of the presenter and set transparent colors for the background and remove the borders:

 

<Style TargetType="documentsUI:FixedDocumentPagesPresenter">
    <Setter Property="Background" Value="White" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Template">

        <Setter.Value>
            <ControlTemplate TargetType="documentsUI:FixedDocumentPagesPresenter">
                <Grid>
                    <Border Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                        <ContentPresenter Margin="0" />
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<Style  TargetType="fixedUI:Page">
    <Setter Property="BorderThickness" Value="0"/>
</Style>

 

The namespaces used in the snippet above refer to the following definitions:

 

xmlns:documentsUI="clr-namespace:Telerik.Windows.Documents.UI;assembly=Telerik.Windows.Controls.FixedDocumentViewers"        
xmlns:fixedUI="clr-namespace:Telerik.Windows.Documents.Fixed.UI;assembly=Telerik.Windows.Controls.FixedDocumentViewers"

 

Please, note that you should use implicit styling if you would like to adopt this approach.

Hope this is helpful.

Regards,
Tanya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PDFViewer
Asked by
note prj
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or