Telerik Forums
UI for Xamarin Forum
1 answer
105 views
Is it now or will be, in future, possible to add rotate pdf command?
Didi
Telerik team
 answered on 30 Oct 2019
4 answers
244 views

Hi,

Having used the demo app, I am now trying to add the RadPdfViewer control only to my solution. I am following these instructions (https://docs.telerik.com/devtools/xamarin/controls/pdfviewer/pdfviewer-getting-started).

I initially tried the NuGet package but ran into an "error MSB6006: "java.exe" exited with code 2." situation. I tried increasing the java max heap size passed my current value of 1G, but this did not get resolved.

I then tried the manual DLL reference method, however upon building the solution, I run into the following error :-

error: package com.telerik.android.common does not exist

Therefore, from the list of DLLs for the Android project, it seems like Telerik.Xamarin.Android.Common.dll is missing.

I then reference Telerik.Xamarin.Android.Common.dll and although I am now able to build the solution, I run into the following exception when trying to navigate to a page that contains the RadPdfViewer control :-

NativeResourceProvider.ToPlatformPixels (System.Double dip)
System.TypeInitializationException: Exception of type 'System.Exception' was thrown

 

Am I missing some additional references?

As a side note, is there a way to fix the "error MSB6006: "java.exe" exited with code 2." when using the NuGet package, as this would ideally be my preference.

Didi
Telerik team
 answered on 14 Oct 2019
2 answers
114 views

Hi at All,

i try to open a pdf file from device when using this code :

 

   var doc = DependencyService.Get<IFiles>().GetPath(path);
                var filepath = Path.Combine(doc, pdfName);

                if (File.Exists(filepath))
                {
                    File.OpenRead(filepath);
                    pdfViewer.Source = filepath;

                }

i get this error : an error occured while loading the document.

may be i do somthing wrong !?

 

Gruß

 

 

Abderrazak
Top achievements
Rank 1
 answered on 21 Aug 2019
1 answer
84 views
Hello, I have a problem with the pdfviewer where the first page of a PDF shows its content fine. However, when I click on the button to go to the next page the pdfviewer will not show the page content unless you either zoom in or zoom out, then it updates the view. I have try several PDFs and all have the same problem, including the one that is provided by Telerik, the one with the specifications of the pdfviewer. This happens on Android and iOS. Any idea why this could be happening? Thanks.
Petar Marchev
Telerik team
 answered on 26 Jul 2019
1 answer
98 views
When I display any file in the RadPdfViewer (on iOS, Android, UWP) using either a byte array or file source, when I scroll page the first page and then come back, the first page never re-displays. All the other pages do, but the first page just displays a white rectangle. I have also tried both layout modes and they exhibit the same behavior.
Petar Marchev
Telerik team
 answered on 25 Jun 2019
1 answer
128 views

Hi,

 

Just two questions:

- Is it possible to click on WEB link inside PDF ?

- Whan you zoom in, quality decreases (blur effect), is it normal ? It is not vectorial ?

 

If not, is it planned to add it ?

Thank you

Petar Marchev
Telerik team
 answered on 25 Jun 2019
4 answers
166 views

Hi,

I have a Xamarin Forms project, with Telerik PDF Viewer.

I simply added a PDF Viewer on a page, for testing it:

- opening a PDF with an URL

- Opening a PDF with Stream as Embedded Resource

 

Results:

On IOS, it's OK for Both

On UWP it's OK for Stream loading, but I have an error on URL "An error occurred while loading the document"

On Android, OK for both URL and Stream loading, but when I rotate the device, the PDF Viewer is completely blocked.(tested on Nexus 5X emulator and Samsung S9 real device)

Yana
Telerik team
 answered on 22 Apr 2019
1 answer
160 views

As there currently isn't a way to determine when a page changes when scrolling, I hook into the PropertyChanged event of the RadPdfViewer and check the VisiblePagesStartIndex property, however when scrolling to the last page of the PDF the VisiblePagesStartIndex does not match, for example, I have a 10 page PDF document and when I scroll all the way to the bottom, the last VisiblePagesStartIndex property change is 8, when it should be 9. If I then invoke the NavigateToNextPageCommand then the VisiblePagesStartIndex property changes to the expected value of 9, although I am already at the bottom of the document.

 

In effect I need to know when I reach the end of the PDF so that I can update my own UI buttons to reflect the current position in the document, for example, disabling the down button when I can no longer navigate to a next page. I can achieve this when using the NavigateToNextPageCommand and NavigateToPreviousPageCommand method of document navigation but not when scrolling.

 

I have tried a work around where if the VisiblePagesStartIndex is 8 then invoke the NavigateToNextPageCommand but this doesn't work when scrolling back up the document.

Petar Marchev
Telerik team
 answered on 10 Apr 2019
3 answers
119 views

I would like to invoke the NavigateToNextPageCommand, NavigateToPreviousPageCommand and NavigateToPageCommand commands from code behind however I am having a bit of trouble.

I have successfully invoked the NavigateToNextPageCommand using the following code :-

if (PdfViewerControl2.NavigateToNextPageCommand.CanExecute(null))
{

PdfViewerControl2.NavigateToNextPageCommand.Execute(null);

CurrentPageNumber++;

SetCanExecutes(BindingContext as SmartDocViewModel);
}

However, using a similar approach for the NavigateToPreviousPageCommand, the CanExecute method against the command returns false.

Also I am trying to invoke the NavigateToPageCommand in such a way that it acts as a beginning/end command, so I pass either 1 or the VisiblePagesCount value (last page) to the NavigateToPageCommand command however it does not change the page.

The provided sample uses the commands directly via buttons in the XAML however due to my use case I need to invoke the commands in code behind.

Would you be able to help me?

Petar Marchev
Telerik team
 answered on 10 Apr 2019
1 answer
177 views
PdfViewer : FitToWidth on StartUp?

 

Is there a setting to set the viewer to display fit to width when the pdf file opens?

 

<?xml version="1.0" encoding="utf-8" ?>
             xmlns:telerikPdf="clr-namespace:Telerik.XamarinForms.PdfViewer;assembly=Telerik.XamarinForms.PdfViewer"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:telerikCommon="clr-namespace:Telerik.XamarinForms.Common;assembly=Telerik.XamarinForms.Common"
             x:Class="TelerikXamarinApp1.Portable.Page1">
    <ContentPage.Content>
 
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <telerikPdf:RadPdfViewerToolbar PdfViewer="{Binding Source={x:Reference pdfViewer}}">
                <telerikPdf:ZoomInToolbarItem />
                <telerikPdf:ZoomOutToolbarItem />
                <telerikPdf:NavigateToNextPageToolbarItem/>
                <telerikPdf:NavigateToPreviousPageToolbarItem/>
                <telerikPdf:NavigateToPageToolbarItem/>
                <telerikPdf:FitToWidthToolbarItem/>
                <!--<telerikPdf:ToggleLayoutModeToolbarItem/>-->
            </telerikPdf:RadPdfViewerToolbar>
            <telerikPdf:RadPdfViewer x:Name="pdfViewer" Grid.Row="1" FitToWidthCommand=""/>
        </Grid>
         
        <!--<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <telerikCommon:RadUniformGrid>
                <Button Text="Zoom In"
                Command="{Binding Source={x:Reference pdfViewer}, Path=ZoomInCommand}" />
                <Button Text="Zoom Out"
                Command="{Binding Source={x:Reference pdfViewer}, Path=ZoomOutCommand}" />
                <Button Text="Fit To Width"
                Command="{Binding Source={x:Reference pdfViewer}, Path=FitToWidthCommand}" />
                <Button Text="Previous Page"
                Command="{Binding Source={x:Reference pdfViewer}, Path=NavigateToPreviousPageCommand}" />
                <Button Text="Next Page"
                Command="{Binding Source={x:Reference pdfViewer}, Path=NavigateToNextPageCommand}" />
            </telerikCommon:RadUniformGrid>
            <telerikPdf:RadPdfViewer x:Name="pdfViewer"
                                   Grid.Row="1"
                                   MinZoomLevel="0.3"
                                   MaxZoomLevel="4"/>
        </Grid>-->
         
        <!--<StackLayout>
            <Label Text="Invoice Viewer"
                VerticalOptions="CenterAndExpand"
                HorizontalOptions="CenterAndExpand" />
 
            <telerikPdf:RadPdfViewerToolbar PdfViewer="{Binding Source={x:Reference pdfViewer}}">
                <telerikPdf:NavigateToPreviousPageToolbarItem />
                <telerikPdf:NavigateToPageToolbarItem/>
                <telerikPdf:NavigateToNextPageToolbarItem />
                <telerikPdf:ZoomInToolbarItem/>
                <telerikPdf:ZoomOutToolbarItem/>
                <telerikPdf:FitToWidthToolbarItem/>
            </telerikPdf:RadPdfViewerToolbar>
            <telerikPdf:RadPdfViewer x:Name="pdfViewer" Scale="50"
                                      FitToWidthCommand="True"
                                     />
             
        </StackLayout>-->
    </ContentPage.Content>
</ContentPage>

 

 

Regards,

Graham

Didi
Telerik team
 answered on 08 Feb 2019
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?