Using jspdf.js min vs jspdf.debug.js

Hi there,
I am using jspdf plugin to generate PDF from html.  When I use jspdf.debug.js it works fine.  However, when I change that to jspdf.min.js, it does not work.
I am getting the following error.

Uncaught ReferenceError: jsPDF is not defined

I tried to minimize the file using yui compressor, but it is complaining about syntax errors in the jspdf.debug.js file.
ambuliAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
>>Uncaught ReferenceError: jsPDF is not defined
My best guess is that somewhere in the un-minified version of the plugin, you have a line of javascript that ends in newline without a semicolon at the end -ex:
var x=3;
var y=4
var z=5;

minifiers tend to get rid of newlines.  So the above statements may be ending up bunched together as:
var x=3;var y=4var z=5;

notice that the resulting value assigned to y is no longer a valid statement.   Because of this, execution of the script halts.  If this issue is happening in the middle of the definition of your jsPDF object, then its definition never completes due to the halt of execution caused by the syntax error and jsPDF remains undefined.

If you take the three un-minified sample statements above, paste them at http://www.jslint.com/, and click "JSLint", it will report errors/warnings.  The problem with the missing semicolon is reported as:
Expected ';' ....

So, paste your unminified code, submit, and then search for all instances of Expected ';', then add a semicolon on the original source.  Once you are done, then attempt the minification process again.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.