-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
pdf.js cannot be minified #2479
Comments
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? did you use this pdf.js file? i tried it with the 2.4.7 version of yuicompressor and it worked without any errors using the console: |
hi, 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 take a look at
running yuicompressor with the default settings isnt always the best choice |
Hi, |
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 What did you type in your command line? |
I can confirm this error after minification: SyntaxError: octal literals and octal escape sequences are deprecated ...-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. |
👍 great =) |
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
The text was updated successfully, but these errors were encountered: