Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to draw page from a partial PDF #4

Closed
WalterShao opened this issue Mar 26, 2013 · 3 comments
Closed

failed to draw page from a partial PDF #4

WalterShao opened this issue Mar 26, 2013 · 3 comments

Comments

@WalterShao
Copy link

Hi,

I got a PDF file which has required headers and pdf objects for rendering page #1 (but lacking other page objects, total 16 pages). I can use other PDF viewers (such as Adobe reader or Foxit Reader) to open the pdf and read the page #1. I can also mupdf win32 viewer to read page #1. However, when I use the MuPDF.WinRT to draw page #1, it throws an unknown exception. Since the mupdf win32 viewer can read the pdf successfully, I guess MuPDF.WinRT do more checking so that it failed to read the pdf. Would you please help to skip the checking so that it can render the partial pdf file as mupdf win32 viewer can do?

The following is my code in c#:

StorageFile dlFile = await ApplicationData.Current.LocalFolder.GetFileAsync("partial.pdf");

IBuffer pdfBuffer = await FileIO.ReadBufferAsync(dlFile);
Document pdfDocHandle = Document.Create(pdfBuffer, // - file
DocumentType.PDF, // type
150); // - dpi
try
{
MuPDFWinRT.Point sizeP = pdfDocHandle.GetPageSize(1);
WriteableBitmap tmpBmp = new WriteableBitmap(sizeP.X, sizeP.Y);
pdfDocHandle.DrawPage(1, tmpBmp.PixelBuffer, 0, 0, sizeP.X, sizeP.Y, false);
tmpBmp.Invalidate();
imgPdf.Source = tmpBmp;
}
catch (Exception ex)
{
Debug.WriteLine("MuPDF error on showing page:1, ex=" + ex.Message);
}

I'd like to upload the partial pdf for reference, but don't know how to do it. Please let me know how to give the partial pdf to you if needed. Thanks.

@MishaUliutin
Copy link
Owner

Could you send this pdf file to mishacertificate at gmail.com email please?

@WalterShao
Copy link
Author

Sent. Let me know if you didn't get it. Thanks.

@WalterShao
Copy link
Author

Sorry, please ignore this issue. The failure is due to my code's bug. I have fixed the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants