Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Certain types of pdfs are not visible . #79

Closed
zerocold96 opened this issue Apr 14, 2016 · 5 comments
Closed

Certain types of pdfs are not visible . #79

zerocold96 opened this issue Apr 14, 2016 · 5 comments
Assignees

Comments

@zerocold96
Copy link
Contributor

Using the Zoomable pdf viewer worked great at first, but then I noticed a small subsect of pdf that can't be display. I Looked around the code and the one thing I noticed is that CGPDFDocument is reading the file just fine, but when it is time to create the subsampling image the view shows a white page.

I exported the pdfs to pdf on my mac and now the file is bigger and they can be view on the device. Is it a compression issues? or is the formatting for the original pdf different?

// make the initial view 'fit to width'
            CGRect pageRect = page.GetBoxRect (CGPDFBox.Media);
            //scale = Frame.Width / pageRect.Width;
            scale = Frame.Width / pageRect.Width;
            pageRect.Size = new CGSize (pageRect.Width * scale , pageRect.Height * scale);

            // create bitmap version of the PDF page, to be used (scaled)
            // when no other (tiled) view are visible
            UIGraphics.BeginImageContext (pageRect.Size);
            CGContext context = UIGraphics.GetCurrentContext ();
            //CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();
            //CGBitmapContext context = new CGBitmapContext(null, (int)pageRect.Size.Width, (int)pageRect.Size.Height, 8, (int)pageRect.Size.Width * 4, colorSpace , CGImageAlphaInfo.PremultipliedLast);

            // fill with white background
            context.SetFillColor (1.0f, 1.0f, 1.0f, 1.0f);
            context.FillRect (pageRect);
            context.SaveState ();
@olegoid
Copy link
Contributor

olegoid commented Apr 19, 2016

Hi @zerocold96, could you attach your pdf file?

@olegoid olegoid self-assigned this Apr 19, 2016
@zerocold96
Copy link
Contributor Author

15b9a77c-a05d-4dcb-9f38-e7423c55474e.pdf

It displays only a white page.

@Arpit360
Copy link
Contributor

I have reported bug in bugzilla for this issue
https://bugzilla.xamarin.com/show_bug.cgi?id=42229

@olegoid
Copy link
Contributor

olegoid commented Jun 30, 2016

@zerocold96, I think there's nothing wrong with ZoomingPdfViewer sample. It's desgined to work this way and it seems like document you're using is too large to be displayed correctly with this app. However you can try other samples like QuartzSample where your pdf file displayed correcly.

@olegoid olegoid closed this as completed Jun 30, 2016
@zerocold96
Copy link
Contributor Author

Yes the quartzsample can read the pdf just fine.... this is odd. I will compare the samples and make notes of the differences. I must make a point of saying that I have other pdf files that do work just fine this way and are about the same size or bigger (both mb and pixels).

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

No branches or pull requests

3 participants