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

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

Post by mwlceric »

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?
User avatar
DanRaisch
Moderator
Posts: 127185
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

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

Post by DanRaisch »

Moving to Firefox Builds where pre-release versions are discussed.
User avatar
WaltS48
Posts: 5141
Joined: May 7th, 2010, 9:38 am
Location: Pennsylvania, USA

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

Post by WaltS48 »

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.
Linux Desktop - AMD Athlon(tm) II X3 455 3.3GHz | 8.0GB RAM | GeForce GT 630
Windows Notebook - AMD A8 7410 2.2GHz | 6.0GB RAM | AMD Radeon R5
mwlceric
Posts: 3
Joined: January 26th, 2013, 9:13 am

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

Post by mwlceric »

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: 469
Joined: August 30th, 2012, 4:27 am

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

Post by Are You A Wiiizard? »

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...
User avatar
_Alexander
Posts: 1197
Joined: April 1st, 2010, 2:24 pm
Location: Your augmented reality

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

Post by _Alexander »

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
User avatar
Frank Lion
Posts: 21173
Joined: April 23rd, 2004, 6:59 pm
Location: ... The Exorcist....United Kingdom
Contact:

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

Post by Frank Lion »

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.
"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

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

Post by phuzi0n »

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

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

Post by mwlceric »

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: 602
Joined: October 5th, 2006, 2:54 pm

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

Post by Rodze »

_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.
User avatar
Grantius
Posts: 1545
Joined: June 28th, 2011, 4:14 pm
Contact:

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

Post by Grantius »

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), Windows 10/Ubuntu
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10 x86
Mobile:Xiaomi Redmi Note 3 Pro
phuzi0n
Posts: 517
Joined: June 23rd, 2010, 5:48 pm

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

Post by phuzi0n »

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...
User avatar
JayhawksRock
Posts: 10433
Joined: October 24th, 2010, 8:51 am

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

Post by JayhawksRock »

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
"The trouble with quotes on the internet is you never know if they are genuine" ...Abraham Lincoln
phuzi0n
Posts: 517
Joined: June 23rd, 2010, 5:48 pm

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

Post by phuzi0n »

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: 602
Joined: October 5th, 2006, 2:54 pm

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

Post by Rodze »

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.
Post Reply