Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from yurydelendik/master
Using source code from the pdf.js; adds jbig2/jpx parsers.
- Loading branch information
Showing
15 changed files
with
4,723 additions
and
984 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
node_modules/ | ||
pdf.js/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2015 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module.exports = function(grunt) { | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
uglify: { | ||
default: { | ||
options: { | ||
preserveComments: 'some', | ||
screwIE8: true, | ||
beautify: true, | ||
compress: false, | ||
mangle: false | ||
}, | ||
files: { | ||
'jpg.js': ['src/jpg.js', 'build/pdfjs.js'] | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
function includeFiles(src, dest) { | ||
var fs = require('fs'), path = require('path'); | ||
function process(src) { | ||
var content = fs.readFileSync(src).toString(); | ||
return content.replace(/\/\/#include\s+"([^"]+)[^\n]+/g, function (all, file) { | ||
file = path.join(path.dirname(src), file); | ||
return process(file); | ||
}); | ||
} | ||
fs.writeFileSync(dest, process(src)); | ||
} | ||
|
||
grunt.registerTask('build-pdfjs', function () { | ||
grunt.file.mkdir('build'); | ||
|
||
includeFiles('src/pdfjs.js', 'build/pdfjs.js'); | ||
|
||
// HACK patching JBIG2, see also src/pdfjs.js | ||
var fs = require('fs'); | ||
var content = fs.readFileSync('build/pdfjs.js').toString(); | ||
fs.writeFileSync('build/pdfjs.js', content.replace('return visitor.buffer;', 'return visitor;')); | ||
}); | ||
|
||
grunt.registerTask('default', ['build']); | ||
grunt.registerTask('build', ['build-pdfjs', 'uglify:default']); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
Simple JPEG/DCT data decoder in JavaScript. | ||
Simple JPEG/DCT data decoder in JavaScript. Also this project includes JPEG 2000 and JBIG2 decoders. | ||
|
||
Example URL: http://notmasteryet.github.com/jpgjs/example.html | ||
Example URL: | ||
http://notmasteryet.github.com/jpgjs/example.html | ||
|
||
The images decoders are maintained as part of the PDF.js project, please submit patches there. | ||
|
||
https://github.com/mozilla/pdf.js/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "jpgjs", | ||
"version": "1.0.0", | ||
"keywords": [ | ||
"jpgjs", | ||
"JPEG", | ||
"JPG" | ||
], | ||
"main": [ | ||
"jpg.js" | ||
], | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file not shown.
File renamed without changes
Oops, something went wrong.