Comments (7)
the same to me on windows
from pdftohtmljs.
Same here on Mac OsX on a brew install.
from pdftohtmljs.
I was able to fix this doing the following: (*forgive me for not doing a proper fork and pull request, I needed to get this working quickly)
Lines 3 to 9 in pdftohtml.js
function pdftohtml (path, filename, outfile, options) {
this.path = path;
this.options = options || {};
this.options.additional = [path + '/' + filename];
if (typeof outfile !== "undefined" && outfile !== null) {
this.options.additional.push(path + '/' + outfile);
}
On line 51 in pdftohtml.js
var child = shell.exec('cd ' + self.path + ' && pdf2htmlEX ' + self.options.additional.join(' '), {async:true, silent:true});
I was able to do the following implementation:
exports.resource = function(req, res) {
console.log(req.query);
var extension = path.extname(req.query.resource);
var filename = path.basename(req.query.resource, '.pdf');
var dir = path.dirname(req.query.resource);
if(extension === '.pdf'){
var converter = new pdftohtml(dir, filename + extension, filename + '.html');
converter.preset('default');
converter.success(function() {
console.log('convertion done');
res.send(fse.readFileSync(dir + '/' + filename + '.html', 'UTF-8'));
});
converter.error(function(error) {
console.log('conversion error: ' + error);
});
converter.progress(function(ret) {
console.log ((ret.current*100.0)/ret.total + ' %');
});
converter.convert();
}else{
res.send(fse.readFileSync(req.query.resource, 'UTF-8'));
}
};
I know it's fairly verbose, but just wanted to share:) Now on to cleaning up the html that pdf2htmlEX spits out 👹
from pdftohtmljs.
Also default.js should be:
exports.load = function(pdf2htmlex) {
pdf2htmlex.add_options([
'--zoom 1.3',
'--font-format woff'
]);
return pdf2htmlex
}
from pdftohtmljs.
@hydrotik It was fixed in 2013, the changes just haven't been pushed to NPM yet.
from pdftohtmljs.
Awesome thanks!
from pdftohtmljs.
My apologies for not updating it on npm in timely manner. I've just pushed v0.3.6
to npm which is tested with iojs
and node v0.12.x
@hydrotik --zoom 1.3
and --zoom 1.33
both works on MacOS so I don't see a point here, anyways presets are meant to be subclass. You can always specify your preset file and load it in your code.
from pdftohtmljs.
Related Issues (20)
- Remove shelljs depencency HOT 4
- Cannot access pdftohtmlex debug data sent to stderr. HOT 2
- Sorry, this script requires pdf2htmlEX HOT 1
- Need PDF to HTML with all images HOT 1
- Is there anyway to output the html in a variable? HOT 1
- "Installing" pdf2htmlEX - Error: spawn pdf2htmlEX ENOENT or { code: 1 } HOT 3
- data.split is not a function error HOT 1
- "Installing" pdf2htmlEX - Error: spawn pdf2htmlEX ENOENT or { code: 1 } HOT 9
- Error while executing HOT 2
- Correctly create error on binary child process error HOT 1
- Limit memory/CPU usage on pdf2htmlEX process HOT 1
- How to pass --embed options HOT 1
- --dest-dir not working
- spawn pdf2htmlEX ENOENT HOT 2
- Reporting a vulnerability
- Install issue HOT 3
- Remove dependency on file-system HOT 3
- Unexpected end of input HOT 2
- filenames with spaces not supported HOT 5
- Re: Error code HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdftohtmljs.