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

Blank PDF pages #88

Closed
jmester13 opened this issue Sep 5, 2014 · 31 comments
Closed

Blank PDF pages #88

jmester13 opened this issue Sep 5, 2014 · 31 comments

Comments

@jmester13
Copy link

Hello All,

First off thank you for this tool, it is awesome and I've enjoyed learning about it! I've hit a bit of a issue I'm hoping someone might be able to help me with. I am embedding PDF documents which have been created via Adobe LiveCycle and have run into an issue where the documents pages are loaded but appear blank. If I click on the download button the document loads up without issue and I can scroll without issue. Does anyone have a thought on why I am not able to see document text within the iframe?

All other PDF's seem to work fine, its just Adobe LiveCycle ones that seem to be causing an issue.

Any help you can offer would be great.

@Mas-Tool
Copy link

Mas-Tool commented Sep 6, 2014

We have the same issue, but it appears only on large pdf files.

@simonhayes81
Copy link

Same here - I can open a file of about 150kb but anything bigger than about 500kb and it doesn't want to know.

@jmester13
Copy link
Author

Well I am glad I'm not alone!

So I am able to load larger PDF's without issue on my desktop. I have one that is 1,461kb that loads on my desktop in Chrome without issue and loads on an ipad without issue as well. My Adobe LiveCycle generated pdfs are 159 - 377kb and load on my desktop but not on the iPad. Larger PDF's generated without Adobe LiveCycle, load on both the desktop and on the iPad. These larger documents do take a bit longer to load, but eventually show as readable pages within the iframe.

Is anyone else running into load issues on just the iPad?
Are you both working with Adobe LiveCycle pdfs?

@simonhayes81
Copy link

I'm not sure if this was created with LiveCycle or not. I got sent this PDF that I would like to put on our website. It's 800kb which I wouldn't describe as massive, but just cannot get it to display. I've tried another PDF which is only 100kb and it worked fine.

@adityab
Copy link
Member

adityab commented Sep 8, 2014

Interesting... Do these files contain forms/input fields?

Relevant links:
https://wiki.mozilla.org/PDF.js#Big_project:_XFA_or_AcroForms
mozilla/pdf.js#1773

LiveCycle does appear to generate PDFs that don't work with many free viewers.
Could any of you post a link to such a problematic file?

@simonhayes81
Copy link

Mine doesn't contain forms or fields.

Here is mine: http://www.brookvalehighschool.co.uk/pages/home/documents/Brookvale%20Prospectus.pdf

@jmester13
Copy link
Author

Mine do not have inputs of any type for the user to interact with, they are
simply updated via Adobe LiveCycle and the saved as PDF's

On Mon, Sep 8, 2014 at 10:42 AM, simonhayes81 notifications@github.com
wrote:

Mine doesn't contain forms or fields.

Here is mine:
http://www.brookvalehighschool.co.uk/pages/home/documents/Brookvale%20Prospectus.pdf


Reply to this email directly or view it on GitHub
#88 (comment).

Joe Mester
Designer & Developer
info@joemester.com

@jmester13
Copy link
Author

Hello @adityab,

I can't share my PDF's due to privacy issues, but I can do my best to give you all the information you might need. I'm going to be looking into this project for the next hour or two and would appreciate any input you have.

@jmester13
Copy link
Author

So no solution yet, but hopefully some info and questions to help find one.

Info:

PDF Version is 1.2 (Acrobat 3.x)
Fast Web View: No -- I resaved my PDF so this was Yes, and still got blank pages.
Advanced > Proctected Mode: On
PDF has bookmarks

Questions:

@adityab what other information is going to be useful to understanding and testing this PDF?

Is it possible information is missing in the header for the document that is needed?

@simonhayes81
Copy link

If you click on presentation then the page that you are currently on does show, but if you scroll either way the rest of them are blank.

@haydeny
Copy link

haydeny commented Sep 9, 2014

Just to confirm that I too am seeing the issue, in two different guises. Some docs I am getting blank pages (eg. 12 page pdf shows as 12 blank pages) and other times I am getting only the outer ViewerJS display with a gray background and nothing else.

@jmester13
Copy link
Author

In my case I am getting one of @haydeny 's experiences, "I am getting blank pages (eg. 12 page pdf shows as 12 blank pages) " It seems that viewer.js is getting part of the way there, but not all the way.

Perhaps this is a memory or cache related issue since we are getting part of the PDF's information but not all of it?

@adityab adityab self-assigned this Sep 9, 2014
@adityab adityab added this to the ViewerJS 0.6.0 milestone Sep 9, 2014
@adityab
Copy link
Member

adityab commented Sep 9, 2014

Thanks for pointing that out. It looks like a race condition related to the promise-heavy PDFjs code, that is not properly handled in ViewerJS.
I can't do a very quick fix for this just now due to other tasks, but adding to my TODO. :(

If an urgent, fast-track fix is needed, please send a support email to viewerjs-support@kogmbh.com

(The LiveCycle thing is another issue but I suppose we cannot really do anything about that).

@jmester13
Copy link
Author

I'm glad we were able to locate a reason, I am betting the race condition will resolve the LiveCycle issue. If you wouldn't mind pointing me towards a file or line for that race condition I'll take a stab a cleaning up this TODO. I'd really like to get this working for the project I am working on.

Thanks again for your help!

@jmester13
Copy link
Author

I've done a bit more digging today and am scratching my head still. I dug around for race conditions in the PDFjs code and found that their aren't many of them to review. I spent a bit of time messing with LabCSClosure and with

function fn_g(x) {
if (x >= 6 / 29)
return x * x * x;
else
return (108 / 841) * (x - 4 / 29);
}

but wasn't making much progress. I did some more digging into my PDF's color space and found that my PDF's have a DeviceGray colorspace and I am curious to know if anyone else has PDF's with this color space.

Thanks again for the awesome work you've done so far and taking the time to respond to my posts.

@fidelio314
Copy link

Hello do you have any news about this bug?
thanks

@akszydelko
Copy link

I have something what can be helpful.
After some debugging I noticed that it happen only when pages are rendered in incorrect order.
For example: 1 -> 2 -> 4 -> 3.

With current code it can happen quite often, because of race between rendered pages, each page is rendered asynchronously. And because of some reasons when the order is mixed finishing code is not called this one exacly.

Except this behaviour mixed page rander is bad, because after each page render it is added to DOM here. So when it will be added in wrong order the pages will be displayed in wrong order, I suppose (Right now instead of that we got blank pages).

I have implemented a simple fix which render pages one by one instead of all at the same time. And I have tested that for big pdf and it works perfectly. But I'm not sure if it is the best solution, I haven't read any documentation or tips how it should be done. Just fixed the problem I noticed.
The fix has to be applied in those lines.
And here it is:

// ------ MODIFIED PART ------
var pageIterator = 0;
function createNextPage() {
    if (pageIterator < pdfDocument.numPages) {
        pdfDocument.getPage(pageIterator + 1).then(function (page) {
            createPage(page);
            pageIterator++;
            createNextPage();
        });
    }
}

createNextPage();
// ------ END MODIFIED PART ------
// ------ ORIGINAL PART ------
//for (i = 0; i < pdfDocument.numPages; i += 1) {
//    pdfDocument.getPage(i + 1).then(createPage);
//}
// ------ END ORIGINAL PART ------

Of course it works slower but it works.

@forloops
Copy link

forloops commented Feb 9, 2015

@akszydelko - your fix works. Thank you for sharing

@kossebau
Copy link
Contributor

While I could not reproduce the problem even with the provided PDF the problem @akszydelko found and has described I also see in theory.
ViewerJS 0.5.5 has been released today, and it comes with 7e9ad23 which should ensure the proper order while still making use of the async calls to speedup the loading.
Please try if this new version also works for you and the PDFs you experience problems. (The version of pdf.js was also updated to the latest official release, BTW).
Closing this issue for now, please reopen if there are still problems also with pure 0.5.5.

@simonhayes81
Copy link

I’m still having problems. It seems to work fine in Google Chrome, but in Internet Explorer the PDF takes ages to load and when it does the text is all garbled.

@kossebau
Copy link
Contributor

@simonhayes81 Which version is your Internet Explorer? For what I tested with latest IE10 it seems fine.
Is the PDF you are trying public, so I could test with it as well?

@simonhayes81
Copy link

IE11

I've put it up here: http://www.brookvalehighschool.co.uk/pages/home/prospectus.html

@kossebau kossebau assigned kossebau and unassigned adityab Feb 13, 2015
@kossebau
Copy link
Contributor

Ah, that pdf, even part of my testing set :) Hm, that page works fine in IE10 for me (besides taking some time without any feedback/loading screen, but that is a different issue, tracked in #96).

No IE11 available right now, anyone else could confirm? So far hoping it is a caching issue perhaps? :)

@simonhayes81
Copy link

On further examination, it seems to work fine on Windows 10 in IE 11, but not in Windows 7.

@kossebau
Copy link
Contributor

Could you post a screenshot to get a better idea what "text is all garbled." means?
What I see is that the invisible text layer for selection seems not properly calculated, so it is off for most of the text. That would be an issue in pdf.js, nothing ViewerJS can do about.

@simonhayes81
Copy link

Just done some more testing, and in actual fact it does load properly on Windows 7 with IE11, but takes a very very long time to load (around 2 minutes), an unacceptable amount of time in fact because almost everyone would have given up by then.

Windows 8 IE11 takes too long to load and also has the garbled text problem which I will post in a minute.

Windows 10 IE11 which I'm running on Hyper-V works fine, loads pretty much instantly and the text is as it should be.

@simonhayes81
Copy link

http://www.brookvalehighschool.co.uk/pages/home/garbled.png

That's the shot where the text is garbled.

I suppose you could argue that people shouldn't be using IE and definitely shouldn't be using Windows 8, but would rather find a solution!

@kossebau
Copy link
Contributor

Thanks, I see. Not using IE would indeed be a solution :) but right, reality is what we are here for.

Very possibly some issue in pdf.js then. Nothing I can help with just a few finger snips.

No (free) time to look deeper into that myself, sorry. So it's either hoping someone else has energy and resources to dive into that and see what needs fixing and then fix it. Or you investing into someone doing that (where I of course recommend contacting viewerjs-support@kogmbh.com but then working patches will be accepted for ViewerJS/pdf.js independent of who created them :) ).

@simonhayes81
Copy link

Any ideas why it would do this on Windows 8, but not Windows 7 or Windows 10?

@Tambe257
Copy link

I also have a large pdf the loads super slowly and ends up with blank pages. I don't see a file called PDFViewerPlugin.js when I download the zip file from viewerjs.org. Should I be downloading it directly from Github?

@fmp777
Copy link

fmp777 commented Apr 26, 2016

Getting complaints from IE 11 users myself, had a staff member test and they can reproduce. Edge works fine. Any motion on this?

@thz thz unassigned kossebau Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests