w3nl / ppt-png

Convert ppt to png
MIT License
44 stars 7 forks source link

TypeError: Converter is not a constructor #44

Closed w3nl closed 2 years ago

w3nl commented 2 years ago

https://github.com/w3nl/ppt-png/issues/1#issuecomment-1058123422

const Converter = require('ppt-png')

new Converter({ files: ['peka.pptx'], output: 'output/', invert: false, logLevel: 2, callback: function(data){ console.log(data.files, data.success, data.files, data.time) } }).run()

TypeError: Converter is not a constructor
w3nl commented 2 years ago

@AlexanderKozhevin

It works, but in version 1.x.x there are breaking changes. It works now like:

const converter = Converter.create({
  files: ['peka.pptx'],
  output: 'output/'
});

const result = converter.convert();

console.log(result);

I have to add some missing features from 0.x like invert, but i think the current codebase is more clean and easier to maintain for me.

Now it's based on a generic convert package: https://www.npmjs.com/package/%40hckrnews%2Fconverter And have split the 2 converters to new packages: https://www.npmjs.com/package/%40hckrnews%2Fpdf2png https://www.npmjs.com/package/%40hckrnews%2Fppt2pdf So this ppt-png will run both converters: https://github.com/w3nl/ppt-png/blob/master/src/converter.js#L39

Check also the example code in the codebase and the readme like: https://github.com/w3nl/ppt-png/blob/master/test/test2.js

For all features, you can use version 0.x.x with the old code style for running this converter.