MozillaZine

How to disable pdf.js programatically (in HTML/JS)?

Discussion about official Mozilla Firefox builds
mwlceric
 
Posts: 3
Joined: January 26th, 2013, 9:13 am

Post Posted January 26th, 2013, 9:50 am

We embed PDFs in our web app for high fidelity printing of customized PDFs -- receipts, invoices, packing slips, private healthcare letters, etc -- since it lets us 100% control how it is printed.

A good 90% of these PDFs look absolutely terrible when rendered with pdf.js -- or printing does not work, or printing is unbearably slow.

Long-term, we'll file bugs against pdf.js when we can isolate specific test cases.

Short-term, for Firefox 19, is there ANY way we can force embedding through Adobe Acrobat / Reader? Any specific <object> or <embed> combination? Or maybe some way to detect pdf.js is enabled and alert users how to disable it for now?

DanRaisch
Moderator

User avatar
 
Posts: 106504
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the East Coast

Post Posted January 26th, 2013, 10:31 am

Moving to Firefox Builds where pre-release versions are discussed.
Vista Home Premium 64 - FX 37.0.1 & TB 31.6.0 Win 8.1 - FX 37.0.1 and TB 31.6.0

WLS

User avatar
 
Posts: 2025
Joined: May 7th, 2010, 9:38 am
Location: Pennsylvania, USA

Post Posted January 26th, 2013, 1:00 pm

mwlceric wrote: Or maybe some way to detect pdf.js is enabled and alert users how to disable it for now?


Enter about:config in the Navigation Bar, search for pdfjs.disabled, and toggle it to true.

Then you probably will have to select what application you want to use in Tools > Options > Applications.
AMD Athlon(tm) II X3 455 3.3GHz | 4.0GB RAM | GeForce GT 630
Kubuntu 14.10 | KDE 4.14.1

mwlceric
 
Posts: 3
Joined: January 26th, 2013, 9:13 am

Post Posted January 26th, 2013, 1:14 pm

WLS wrote:Enter about:config in the Navigation Bar, search for pdfjs.disabled, and toggle it to true.

Then you probably will have to select what application you want to use in Tools > Options > Applications.


I can disable it for my browser, yes. But we have thousands of PCs used by our users that we don't have direct control over - if any of them upgrade to Firefox 19 and 19 ships with pdf.js on by default, it will be a disaster. We'll have to require them to all use IE unless there is a way for me to detect that they are using pdf.js and give instructions on how to disable it.

Are You A Wiiizard?
 
Posts: 86
Joined: August 30th, 2012, 4:27 am

Post Posted January 26th, 2013, 1:55 pm

If you're dealing with 1000s of computers, wouldn't it be wiser to be using ESR?
Setting pdfjs.disabled could probably be done by making an easy script to write in userprefs (or something like that) file but I'm not sure how you would get Firefox to force use adobe reader again by script... Hmm...

_Alexander

User avatar
 
Posts: 1197
Joined: April 1st, 2010, 2:24 pm
Location: Your augmented reality

Post Posted January 26th, 2013, 3:16 pm

I agree w/ OP, pdf.js will have horrible fallout.
http://magneticpudding.com/ <- My Blog
i5 3570k @ 4.5 Ghz / NV 660 / 32GB DDR3 / 1080p LCD / SSD (120 + 180) / W8 ||| Atom N270 / NV ION / 3GB DDR3 / SSD / 1366x768 / W8

Frank Lion

User avatar
 
Posts: 17372
Joined: April 23rd, 2004, 6:59 pm
Location: ... The Exorcist... United Kingdom

Post Posted January 26th, 2013, 3:47 pm

mwlceric wrote:We'll have to require them to all use IE unless th

Err, no...............you just have to require them all to click the notification button at the top right of the notification bar that will display and reads 'This stuff may not display correctly, whatever...' and select the .pdf reader of their choice.

Users are not children and can just about manage to click one single button. They are also not usually dictated to as to their choice of applications either and even Adobe doesn't insist that I read their tripe using Acrobat.

Either way, hardly an issue to be rushing about like a man with his hair on fire over.
Metal Lion latest Firefox Themes -Tiger SP, Tiger, Graphite, Australis
"The only thing necessary for the triumph of evil, is for good men to do nothing." - Edmund Burke (attrib.)

phuzi0n
 
Posts: 517
Joined: June 23rd, 2010, 5:48 pm

Post Posted January 26th, 2013, 4:07 pm

Seren666 wrote:If you're dealing with 1000s of computers, wouldn't it be wiser to be using ESR?
Setting pdfjs.disabled could probably be done by making an easy script to write in userprefs (or something like that) file but I'm not sure how you would get Firefox to force use adobe reader again by script... Hmm...

AFAICT the OP runs a public website and has no control over what their users have installed so an extended support release isn't a solution.

I think the only way to detect if it is enabled is to embed a pdf and then run some JS code to check for the PDFJS.version variable. If you're linking directly to the pdf files and not embedding them then either embed them or embed a small dummy pdf file so that pdf.js loads as part of your page instead of on a new page.
Last edited by phuzi0n on January 26th, 2013, 4:13 pm, edited 1 time in total.

mwlceric
 
Posts: 3
Joined: January 26th, 2013, 9:13 am

Post Posted January 26th, 2013, 4:12 pm

phuzi0n wrote:I think the only way to detect if it is enabled is to embed a small dummy pdf and then run some JS code to check for the PDFJS.version variable.


Oh, awesome. I'll give that a shot, it sounds promising.

Really we just want to warn users and block specific PDFs that we know for a fact are wrong. For example, proofs generated from print design software (Adobe Creative Suite) that have spot colors, annotations, or other embedded media do NOT work in pdf.js (yet). Same thing with fillable forms (payroll / insurance forms).

If it works out, I'll make sure to post the code in the parent post for others to find.

Rodze
 
Posts: 596
Joined: October 5th, 2006, 2:54 pm

Post Posted January 27th, 2013, 8:25 pm

_Alexander wrote:I agree w/ OP, pdf.js will have horrible fallout.


Yeah, I don't know why they're pushing this at all. It's still at least a couple years away from being an acceptable substitute.

Grantius

User avatar
 
Posts: 1191
Joined: June 28th, 2011, 4:14 pm

Post Posted January 27th, 2013, 9:07 pm

Rodze wrote:
_Alexander wrote:I agree w/ OP, pdf.js will have horrible fallout.


Yeah, I don't know why they're pushing this at all. It's still at least a couple years away from being an acceptable substitute.


I use it and it doesn't lock up like Adobe does, and looks nicer IMHO then Foxit.

Each to their own though.
Micro gaming box: AMD A10-7800 APU, 8gb RAM M350 ITX case (size of a book), Ubuntu 15.04/W10TP
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10TP x86, Nightly 32bit
Mobile:Note 3 with CM12, Nightly FF

phuzi0n
 
Posts: 517
Joined: June 23rd, 2010, 5:48 pm

Post Posted January 27th, 2013, 10:47 pm

Grantius wrote:
Rodze wrote:
_Alexander wrote:I agree w/ OP, pdf.js will have horrible fallout.


Yeah, I don't know why they're pushing this at all. It's still at least a couple years away from being an acceptable substitute.


I use it and it doesn't lock up like Adobe does, and looks nicer IMHO then Foxit.

Each to their own though.

"To each their own" doesn't seem to fit with Mozilla hijacking the mime-type from adobe reader or other pdf apps which the user explicitly installed on their system to read pdf's with. It doesn't even ask you whether you want to use it by default or not, it only gives the notification button that saves the file so that you can then go and open it with another app. The default behavior should either be as a fallback if nothing else is handling the mime-type, or to ask whether you want to use it as the default or not, it shouldn't be hijacking the mime-type and making you dig through options to disable it.

ps. I don't use pdf's enough to know/care how good pdf.js is but I can not stand programs that steal the mime-type without asking. I thought we got rid of this sort of dirty behavior from reputable organizations a decade ago...

JayhawksRock

User avatar
 
Posts: 8566
Joined: October 24th, 2010, 8:51 am

Post Posted January 27th, 2013, 11:00 pm

I doubt anyone from Mozilla will see your Rant here.. Why dont you express your great displeasure here > http://support.mozilla.org/en-US/produc ... =inproduct
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done."
~ Andy Rooney

phuzi0n
 
Posts: 517
Joined: June 23rd, 2010, 5:48 pm

Post Posted January 28th, 2013, 1:01 am

JayhawksRock wrote:I doubt anyone from Mozilla will see your Rant here.. Why dont you express your great displeasure here > http://support.mozilla.org/en-US/produc ... =inproduct

Is that a joke? The page you linked is basically a beginners FAQ that ironically links back to mozillazine. I know how to submit to mozilla and I know that it most often gets lost in the noise, ignored, or disagreed with. I also know that many devs do read and post on these forums so there is a chance it will be seen. Regardless, things like this usually don't change until after mozilla get major backlash in the media.

Rodze
 
Posts: 596
Joined: October 5th, 2006, 2:54 pm

Post Posted January 28th, 2013, 5:06 am

Can't you just force the user to not open the PDF in the browser at all? I don't know the code (MIME whatever), but I click PDF links that ask me to save/open with instead of opening directly in Firefox.

As for talking to Mozilla, here's a list of PDF Viewers bugs: https://bugzilla.mozilla.org/buglist.cg ... ct=Firefox

See if there's a bug to for whatever you want. If there isn't anything or you can't find anything, file a new bug suggesting that.

Grantius wrote:
Rodze wrote:
_Alexander wrote:I agree w/ OP, pdf.js will have horrible fallout.

Yeah, I don't know why they're pushing this at all. It's still at least a couple years away from being an acceptable substitute.

I use it and it doesn't lock up like Adobe does, and looks nicer IMHO then Foxit.

Each to their own though.

There's no "to each their own" (unless you have a machine that was tailor made to make pdf.js faster than Adobe). Pdf.js doesn't lock up to open itself, yes, but it takes its sweet time to render the actual PDF (when it renders). Adobe is pretty much instant after it's loaded.

I never looked into metrics or know if Mozilla has them, I guess 99.9% of the users open only one PDF document once a month, so maybe that's what motivated them.

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 6 guests