Am opening the PDF file as Image and displaying it in a flipview.
public async void OpenPDF(StorageFile file)
{
var pdfFile = await PdfDocument.LoadFromFileAsync(file);
if (pdfFile == null)
return;
for (uint i = 0; i < pdfFile.PageCount; i++)
{
StorageFolder tempFolder = ApplicationData.Current.LocalFolder;
StorageFile jpgFile = await tempFolder.CreateFileAsync(pdfFile + "-Page-" + i.ToString() + ".png", CreationCollisionOption.ReplaceExisting);
var pdfPage = pdfFile.GetPage(i);
if (jpgFile != null && pdfPage != null)
{
IRandomAccessStream randomStream = await jpgFile.OpenAsync(FileAccessMode.ReadWrite);
await pdfPage.RenderToStreamAsync(randomStream);
await randomStream.FlushAsync();
randomStream.Dispose();
pdfPage.Dispose();
}
PdfImages.Add(jpgFile.Path);
}
this.pdfViewer.ItemsSource = PdfImages;
}
I need to change the views(FitWidth,FitPage,100%) like windows 8.1 PDF viewer.
In windows 8.1 app I used Reader app and it will open the PDF side by side to app screen. But in UWP its not working like the same. So am looking for alternatives. Many PDF viewer is available, but all needs to be licensed. So is there any free source available?.