Closed kennyx closed 11 years ago
which version of yuicompressor are you using? 2.4.8pre doesnt work (has some syntax errors) but yuicompressor 2.4.4 works
https://github.com/yui/yuicompressor/tags - yuicompressor-35.zip
v2.4, downloaded from yahoo's official site
from where exactly? which version? 2.4.x? which x? 2.4.7? here on github is always the latest version
did you use this pdf.js file? https://github.com/mozilla/pdf.js/blob/gh-pages/build/pdf.js
i tried it with the 2.4.7 version of yuicompressor and it worked without any errors using the console:
java -jar yuicompressor-2.4.7.jar -o pdf.min.js pdf.js
hi, I used yuicompressor 2.4.7. (https://github.com/yui/yuicompressor/downloads) to compress pdf.js, and after that i doesn't work for me either. After minification I see following exception in js console:Error: stream must have data pdf.min.js:1 at cG (http://localhost:8888/lib/plugins/pdf.min.js:1:8200) at by (http://localhost:8888/lib/plugins/pdf.min.js:1:8799) at Object.d7 (http://localhost:8888/lib/plugins/pdf.min.js:1:5050) at Object.d5 (http://localhost:8888/lib/plugins/pdf.min.js:1:4924) at d9 (http://localhost:8888/lib/plugins/pdf.min.js:1:844286) at eb (http://localhost:8888/lib/plugins/pdf.min.js:1:845333) at <error: Error: INVALID_STATE_ERR: DOM Exception 11>
If I change it back to non-minified version, then it renders pdf.
To speed up the execution, the lookup tables is used in the pdf.js code to resolve e.g. glyph names to codes. If compressor/minifier changes the properties names then you will get some kind of error. Adjust compression level so properties will not be renamed, Closing as won't fix
right, also minifying does work but you have to choose the right options: http://developer.yahoo.com/yui/compressor/#using
take a look at
--nomunge
Minify only. Do not obfuscate local symbols.
running yuicompressor with the default settings isnt always the best choice
Hi, thanks for suggestions. But it doesn't help. I tried to use all the YUI compressor js options (--nomunge, --disable-optimizations and even --preserve-semi), but it still throws same exception. So for now I'll just use non-minified version.
Then you are doing something wrong because then yuicompressor wont change the variables and so on.
Does the minified version have the right file encoding? Did you try -v or --verbose
?
Also you can try google closure compiler which is also very often used and common and should work.
What did you type in your command line?
I can confirm this error after minification:
SyntaxError: octal literals and octal escape sequences are deprecated [Break On This Error]
...-b);var w=n.yMax||y,E=-n.yMin||-b;return"\0$ô\0\0\0»\0\0\0»\0\0ß\01...
happens with many tools.
I cannot find a way to min pdf.js. Weird
Hm really weird, maybe someone should file an issue for yuicompressor on GitHub? https://github.com/yui/yuicompressor
https://github.com/tml is the new maintainer
Does not make any sense to include a minified version of pdf.js during make process?
Sure, why not? But which compressor works or which one should we use? Did you contact https://github.com/tml?
I will write to uglifier guys cause I tested on that system.
One or more of my pending changes to YUICompressor fixes this issue. See http://tml.github.com/pdfjs/examples/acroforms/index.html (which is using http://tml.github.com/pdfjs/examples/acroforms/min.pdf.js, generated by my in-development YUICompressor 2.4.8pre). I will identify which pending change it is and do my best to make sure it gets into the 2.4.8 release.
:+1: great =) then we can finally minify pdf.js with it =)
With nodejs minify you get the same issue. I'm going try with yuicompressor.
Minifying process is well-done using latest yui-composer I cloned from https://github.com/yui/yuicompressor (2.4.8 maybe).
The use of strict mode complained about some octal codes not being allowed in the minified code. It worked after removing the "strict mode".
I must add that I compressed using http://jscompress.com/, which uses UglifyJS. The compressed file size is 895K, a 46% compression.
Uglifyjs can minify pdfjs, but the resulting code is not usable in firefox (SyntaxError: octal literals and octal escape sequences are deprecated).
I was able to minify pdfjs with slimit (https://pypi.python.org/pypi/slimit/) and have the minified pdfjs running correctly on firefox. No issue so far.
@arifwn I didn't know slimit. I'll give it a try!
Google Closure Compiler minifies without any problems. https://github.com/DanielRuf/pdf.daniel-ruf.de/blob/master/README.md
Thanks a lot! I'll try it soon!
Works for me too. I am using on rails with the closure-compile gem for the asset pipeline
I tried Google Closure Tools and YUI Compressor, both of them cannot compress pdf.js