0

Because the PdfDocument class is only available in Windows 8.1, there is something to use in a Windows phone 8.1 (windows runtime) for render a pdf file inside my app?

Edit

MuPdf Works great! But to make it work in a Windows Phone project i had to manually edit the .csproj

i had to add this code :

<Reference Include="MuPDFWinRT, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Platform)'=='x86'">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\MuPDF\x86\MuPDFWinRT.winmd</HintPath>
</Reference>
<Reference Include="MuPDFWinRT, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Platform)'=='ARM' ">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\MuPDF\ARM\MuPDFWinRT.winmd</HintPath>
</Reference>

and this is a usage example:

IBuffer readBuffer = pdf.AsBuffer();

var pdfDocument = Document.Create(readBuffer, DocumentType.PDF, (int)Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi);

List<WriteableBitmap> imageList = new List<WriteableBitmap>();

for (int i = 0; i < pdfDocument.PageCount; i++)
{
    var size = pdfDocument.GetPageSize(i);
    var width = size.X;
    var height = size.Y;

    var image = new WriteableBitmap(width, height);
    IBuffer buf = new Buffer(image.PixelBuffer.Capacity);
    buf.Length = image.PixelBuffer.Length;

    pdfDocument.DrawPage(i, buf, 0, 0, width, height, false);

    using (var stream = buf.AsStream())
    {
        await stream.CopyToAsync(image.PixelBuffer.AsStream());
    }

    imageList.Add(image);
}
0

1 Answer 1

1

You could try MuPDF : https://github.com/MishaUliutin/MuPDF.WinRT .

MuPDF.WinRT is a lightweight PDF, XPS and CBZ viewer and parser/rendering WinRT component.

If that's not working.. please see this library as well : http://www.xfiniumpdf.com/xfinium-pdf-downloads.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.