Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

merging problem #32

Open
Tushark690 opened this issue May 1, 2021 · 1 comment
Open

merging problem #32

Tushark690 opened this issue May 1, 2021 · 1 comment

Comments

@Tushark690
Copy link

I am trying to merge pdf which is inside a folder of project.
My program is :
When you upload first pdf it will store in a public/uploads folder.
and when next time you upload a pdf. it read the entire folder and merge all of them into one and so on.

It was working ok in my local windows machine.
But when i uploaded to heroku it stopped working.

I used absolute path of files.

fs.readdir('./public/uploads', (err, files) => {
files.forEach(file => {
if (file.split(".")[1] === "pdf") {
list.push(__dirname + "/public/uploads/" + file);
}
})
var outputPath = __dirname + "\public\uploads\" + "studyPdf.pdf";
pdfMerge(list.reverse(), outputPath, function (err) {
if (err) {
res.send(err);
} else {
res.send("success");
}
})
});

When i am trying to do with this it returns an object :

{"killed":false,"code":127,"signal":null,"cmd":"java -jar /app/node_modules/easy-pdf-merge/jar/pdfbox.jar PDFMerger "/app/public/uploads/studyPdf.pdf" "/app/public/uploads/a.pdf" "/app\public\uploads\studyPdf.pdf""}

and when i make the list like list.push(__dirname + "\public\uploads\" + file);

It is showing me no file exists.

also i have tried path package with resolve method. It return the same object.

i also tried with relative path. but nothing works...

@karuppiah7890
Copy link
Owner

Hi ! Thanks for reporting the issue! Unfortunately I currently don't have the bandwidth to checkout the issues currently. PRs are welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants