Closed pankajDevFrontend closed 5 years ago
Is in your code files
an array?
Is in your code
files
an array?
nope, it's just single file.
Ok, the current code can only handle an array.
You can e.g. send an array with the single file.
new Converter({
files: [file],
th the single file.
ok let me check with this solution.
Ok, the current code can only handle an array.
You can e.g. send an array with the single file.
new Converter({ files: [file],
error resolved but not getting response.
callback: function (data) {
console.log(data.failed, data.success, data.files, data.time);
}
there is no response or any error getting inside the callback function.
Can you provide more details? What is the response message? Can you provide more code?
callback: function (data) {
console.log(data);
}
(Can you give all information)
ovide more code?
Here is full code
var Converter = require('ppt-png');
render() {
return (
<div>
<input
type="file"
ref={ref => this.fileFront = ref}
accept=".png,.jpg,.jpeg,.ppt"
name="frontdoc"
onChange={this.handleConvertingfunction} />
</div>
);
}
}
handleConvertingfunction = (event) => {
let files = event.target.files[0];
let mfiles = [];
mfiles.push(files);
new Converter({
files: [mfiles],
output: 'output/',
invert: true,
callback: function (data) {
console.log(data.failed, data.success, data.files, data.time);
}
}).run();
}
but not getting any kind of log or detail or error.
What framework are you using?
I have only test it just in pure Node.js, where files is an array of local files. (not uploaded to a temp dir) So if you show the mfiles, (with e.g. console.log), it can be a path or object with originalname and path. https://github.com/w3nl/ppt-png/blob/master/js/convert.js#L193
If you would see more details in the log, you can also change the logLevel to 4.
What framework are you using?
I have only test it just in pure Node.js, where files is an array of local files. (not uploaded to a temp dir) So if you show the mfiles, (with e.g. console.log), it can be a path or object with originalname and path. https://github.com/w3nl/ppt-png/blob/master/js/convert.js#L193
If you would see more details in the log, you can also change the logLevel to 4.
@w3nl i am using React Js.
Hello @w3nl now i have tried with node js and getting following error can you help me about this error and i am using mac mojave os 10.14.1
[
{
file: '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt',
failure: 'Document convert',
error: {
Error: Commandfailed: libreoffice--headless--convert-topdf--outdiroutput/'/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'/bin/sh: libreoffice: commandnotfoundatChildProcess.exithandler(child_process.js: 297: 12)atChildProcess.emit(events.js: 197: 13)atmaybeClose(internal/child_process.js: 988: 16)atProcess.ChildProcess._handle.onexit(internal/child_process.js: 265: 5)killed: false,
code: 127,
signal: null,
cmd: "libreoffice --headless --convert-to pdf --outdir output/ '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'"
}
}
][
][
'/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'
]5[
{
file: '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt',
failure: 'Document convert',
error: {
Error: Commandfailed: libreoffice--headless--convert-topdf--outdiroutput/'/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'/bin/sh: libreoffice: commandnotfoundatChildProcess.exithandler(child_process.js: 297: 12)atChildProcess.emit(events.js: 197: 13)atmaybeClose(internal/child_process.js: 988: 16)atProcess.ChildProcess._handle.onexit(internal/child_process.js: 265: 5)killed: false,
code: 127,
signal: null,
cmd: "libreoffice --headless --convert-to pdf --outdir output/ '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'"
}
}
][
][
'/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'
]
Ok, the LibreOffice convert doesnt work.
You can test this just with the LibreOffice command:
libreoffice --headless --convert-to pdf --outdir output/ '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'
Is LibreOffice installed? And is your LibreOffice up-to-date?
You can also use another software to convert the document, see: Issue #2
Ok, the LibreOffice convert doesnt work. You can test this just with the LibreOffice command:
libreoffice --headless --convert-to pdf --outdir output/ '/Volumes/Projects/REACTJS/my-app/src/assets/sample.ppt'
Is LibreOffice installed? And is your LibreOffice up-to-date?
You can also use another software to convert the document, see: Issue #2
yes libreOffice installed, need to create output directory like that ?
In your code the output folder is output/
.
That is a relative path in your project.
And yes, you have to create the folder output in your project.
But LibreOffice say: commandnotfoundatChildProcess ...
So it looks like LibreOffice is failing over the command.
Have you tried the LibreOffice command in your terminal?
In your code the output folder is
output/
. That is a relative path in your project. And yes, you have to create the folder output in your project.But LibreOffice say:
commandnotfoundatChildProcess ...
So it looks like LibreOffice is failing over the command.
Have you tried the LibreOffice command in your terminal?
can you share me or explain me command about terminal please ?
LibreOffice (or another alternative) should convert the spreadsheet (ppt/pptx/ods/...) to a pdf file. This pdf file should be stored in the output folder.
The pdf has for every slide a page. Than the pdf will be convert to images, every page will converted to an image. The package https://www.npmjs.com/package/pdf2image is used for this process. This package use Imagemagick for the convert progress. https://bitbucket.org/RicardoCacheira/pdf2image/src/e06968cef3dfa776e039a1b49931389831b71945/index.js#lines-297
I'll have to figure out why the pdf2image action doesnt work.
I have made some changes, can you test it again with version 0.5.1
?
LibreOffice (or another alternative) should convert the spreadsheet (ppt/pptx/ods/...) to a pdf file. This pdf file should be stored in the output folder.
The pdf has for every slide a page. Than the pdf will be convert to images, every page will converted to an image. The package https://www.npmjs.com/package/pdf2image is used for this process. This package use Imagemagick for the convert progress. https://bitbucket.org/RicardoCacheira/pdf2image/src/e06968cef3dfa776e039a1b49931389831b71945/index.js#lines-297
I'll have to figure out why the pdf2image action doesnt work.
ok let me check
Getting same error, please check attached screenshot.
Has the output for write rights?
With version 0.5.2 you receive more information about reading the pdf file. So if it is a write problem, you'll see it.
Let me know if it works.
Let me know if it works.
yes, i have checked and still same issue.
Has the output for write rights?
Yes
Do you have some information about: Operation system Node version ImageMagick version pdfinfo version
@pankajDevFrontend Let me know if i can help you. If you send more details about your system, i can simulate the same situation.
Operation system . - Mac Mojave 10.14.1 (18B75) Node version . - v11.12.0 ImageMagick version - Version: ImageMagick 7.0.8-59 Q16 x86_64 2019-08-05 https://imagemagick.or pdfinfo version - Not able to get pdfinfo version
If pdfinfo -v
in your terminal doesnt work, you need to install the pdfinfo package.
I dont have test the package in node 11, but i think i also works in node 11.
You can try node 10 or 12, that are active node versions (https://github.com/nodejs/Release)
I recommend nvm to switch between node versions: https://github.com/nvm-sh/nvm
Can i close this issue @pankajDevFrontend ?
Getting this error here is my code