Closed malikshubham827 closed 2 years ago
Hi, @malikshubham827; thank you for reporting the issue. Could you please share the operating system you are using? So far, I have tested it only on Linux. I had planned to include the executable of wkhtmltopdf
for windows and mac, but then dropped the plan to keep the bundle size small (it's already 40+ MB 😰).
Let me explore some ways to tackle this problem of os dependent dependencies (after end-sem 😅)! So far, I can only think of having a post-install script to fetch the right binary files based on OS! (But this isn't a good practice). In the worst case, we shall include all the binaries! (let's hope not!🤞)
If you find any solution feel free to share it or post a PR.
The same thing on Windows 10:
$ node index.js
info: Starting operation
info: Removing all files in session Files Dir!!!
info: Creating directories in session Files Dir!!!
info: Starting Html Export Subroutine
info: Task Id: c21b1ca8-c332-43d1-b55b-26ed6790577a
info: Current Task status: success
info: Got the S3 download URL
info: Starting file download
info: File download successful
info: Removing all non dot files and folders from C:\Users\neupo\develop\ebook\session_files\input
info: Files removal success
info: Starting file extraction
info: File extracted successfully
info: Saving the output file as HTML at tmp location
info: Exporting the HTML To Ebook
info: Saving Ebook at [C:\Users\neupo\develop\ebook\session_files\output\merged\prime_book.pdf]
error: main: Error: spawnSync C:\Users\neupo\develop\ebook\node_modules\@subhamx\notion-to-ebook\bin\wkhtmltopdf\wkhtmltopdf ENOENT
Done in 7.81s.
Last step fails and no pdf. No conversion tool wkhtmltopdf
obviously.
I think @subhamX should remove the bin folder and instead add to the readme file this text (copied from https://www.npmjs.com/package/wkhtmltopdf)
First, you need to install the wkhtmltopdf command line tool on your system.
The easiest way to do this is to download a prebuilt version for your system. DO NOT try to use the packages provided by your distribution as they may not be using a patched Qt and have missing features.
@mikolasan It makes sense. Let me give another try to fix the issue with conditional check on the type of OS and then downloading the relevant binary from upstream. If not we will go with the logic you mentioned above.
Unfortunately, I couldn't find a simple way of installing wkhtmltopdf
by getting the hardware architectures, OS distributions, and their version. And even if I could build a post-build script there is no way for me to test it on all of these permutations. 😥
So finally went with the approach as suggested by @mikolasan and left the wkhtmltopdf
installation part to users. Additional check to ensure that wkhtmltopdf
is present in PATH is also included.
Closing this issue for now! Thank you @mikolasan and @malikshubham827 for your valuable inputs 😃. (And my apologies for the late actions).
Hi, I was just giving the project a try but its failing at the last step of converting html to pdf. Logs: