首页 > 解决方案 > 如何控制 iOS 的 PDF 文件的页面

问题描述

我正在创建一个应用程序来向用户显示一些本地 PDF 文件。

该应用程序有 2 个功能:

在 Android 中,我使用 xamarin 的“PDF.JS”插件来显示所有 pdf 文件,它工作正常。通过使用“交互式摘要”,我可以轻松地在我想要的页面中打开 PDF。

另一方面,在 IOS 中,我使用 awebview来显示 pdf。唯一的问题是在为 IOS 创建“交互式摘要”时,我无法弄清楚如何在我想要的页面中打开 PDF 文件。是否有任何库或函数可以让我访问它(pdf 页面)?

我附上了一些代码截图,以便你们了解发生了什么。

图 1

图 2

标签: c#xamarinxamarin.forms

解决方案


我建议使用Syncfusion PDF

它已经拥有您想要的所有功能:

 <Grid x:Name="pdfViewGrid">
        <syncfusion:SfPdfViewer x:Name="pdfViewerControl" InputFileStream="{Binding PdfDocumentStream}"/>
    </Grid>

要更改页面:

<Button x:Name="goToNextButton"  Grid.Column="3" BackgroundColor="Transparent" Image="PageDown.png" HorizontalOptions="Center" VerticalOptions="Center" Command="{Binding GoToNextPageCommand, Source={x:Reference Name=pdfViewerControl}}"/>

<Button x:Name="goToPreviousButton" Grid.Column="4" BackgroundColor="Transparent" Image="PageUp.png" HorizontalOptions="Center" VerticalOptions="Center" Command="{Binding GoToPreviousPageCommand, Source={x:Reference Name=pdfViewerControl}}"/>

推荐阅读