Is there an API for the built-in Windows 8 “Modern reader” PDF Viewer?

戏子无情 提交于 2019-12-20 16:57:52

问题


Windows 8 will include a built-in PDF reader called "Modern Reader". In our current application, we embed the Adobe Reader as an ActiveX control.

Can I embed Windows 8 "Modern Reader" in a similar way?


回答1:


Windows 8.1 has APIs for rendering PDFs. Please have a look at the Windows.Data.Pdf namespace

Build conference session recording available on Channel 9. This details how to use the new PDF rendering APIs.




回答2:


The answer to your question is 'no'. There are (at this time) no published api's for the Modern Reader PDF viewer. The next best thing is the PDF-Tools.com solution which I think might be too generic in it's approach to meet your needs but is still worth checking out.

See: http://www.pdf-tools.com/public/downloads/manuals/vwra.pdf

Sorry to bear bad news. Just don't shoot the messenger :)




回答3:


You can open the PDF file in Windows Reader from your application. This will open the Windows Reader separately.

  StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(filePath));
  Launcher.LaunchFileAsync(file);

filePath is the path to the PDF file.




回答4:


here is a code example on how to render a PDF document into BitmapImages:

private async Task<List<BitmapImage>> LoadPdf()
{
var _pageImages = new List<BitmapImage>();

// Open the file
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("demo.pdf");

// Create PDF document
var pdfDocument = await PdfDocument.LoadFromFileAsync(file);

// Loop through the pages
for (uint i = 0; i < pdfDocument.PageCount; i++)
{
    using (var stream = new InMemoryRandomAccessStream())
    {
        using (var page = pdfDocument.GetPage(i))
        {
            // Set render options
            var renderOptions = new PdfPageRenderOptions
                                        {
                                            BackgroundColor = Colors.LightGray,
                                            DestinationHeight = (uint)(page.Size.Height * 10)
                                        };

            // Render into bitmap image
            await page.RenderToStreamAsync(stream, renderOptions);
            var image = new BitmapImage();
            await image.SetSourceAsync(stream);
            await stream.FlushAsync();
            _pageImages.Add(image);
        }
    }
}

return _pageImages;
}

Original Source: http://www.win8tutorial.net/windows-8-1/render-pdf-documents/

Greetings Christian




回答5:


I have GREAT news. Look what I found: Reading PDF and XPS on your Windows 8 application using WinRT

David Catuhe posted it on Msdn Blog:

PDF and XPS file formats are widely used across the world and you could need one day to display them inside your application.
Today I would like to share with you a simple way to do so by using an open source solution: MuPDF (a multiplatform lightweight PDF and XPS viewer).
The result is a simple but really useful Windows 8 Modern UI app that is able to display a PDF/XPS file.

Hope it's help everyone!




回答6:


PDF Rendering in Store apps has become really easy with Windows 8.1.

Windows 8.1 now has PDF rendering APIs and ability to save/show PDF pages as images. Check out these samples.




回答7:


take a look here ... http://social.msdn.microsoft.com

cause there are no apis available you can use the following javascript framework to integrate your pdf to metro style html5 apps

https://github.com/mozilla/pdf.js




回答8:


Modern PDF Reader is no longer included in the final release of Microsoft Windows 8. I use Cool PDF Reader as an alternative to the Modern PDF Reader. Windows 8 does come with a Reader App in Metro Style, crippled in functionality, especially since it does not allow you to print PDFs. Cool PDF Reader is a nice Windows desktop application to open, view, and even print PDF document.



来源:https://stackoverflow.com/questions/8714500/is-there-an-api-for-the-built-in-windows-8-modern-reader-pdf-viewer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!