Ilyes-El-Majouti / pdftopic

Built for Node.js, this package empowers users to effortlessly convert PDF files into images of exceptional quality, supporting multiple formats including PNG, JPG, GIF, and others. Its streamlined functionality ensures a smooth and reliable conversion process, providing users with the flexibility to obtain top-notch images from their PDF documents
Apache License 2.0
26 stars 6 forks source link

Error: write EOF from ImageMagick #7

Closed yejue closed 6 months ago

yejue commented 7 months ago

Ignore the error in ImageMagick.: ������ - 200

Error: Error: write EOF from ImageMagick \projects\middleearth_tax_new\node_modules_imagemagick-stream@4.1.1@imagemagick-stream\index.js:274 if (!this.listeners('error')) throw err; ^

TypeError: this.listeners is not a function at Object.onerror (\projects\middleearth_tax_new\node_modules_imagemagick-stream@4.1.1@imagemagick-stream\index.js:274:16 ) at imagemagickstream.onerror (\projects\middleearth_tax_new\node_modules_pdftopic@1.0.1-alpha@pdftopic\index.js:25:17)
at Socket.emit (node:events:526:35) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.17.0

Process finished with exit code 1

yejue commented 7 months ago

OS: Windows 10 ImageMagick-7.1.1-Q16-HDRI

Ilyes-El-Majouti commented 7 months ago

Here's how to install ImageMagick on Windows:

  1. Download ImageMagick: Go to the ImageMagick website and download the Windows binary distribution. Choose the version that matches your system architecture (32-bit or 64-bit).

  2. Run the Installer: Once the download is complete, run the installer executable (.exe) file.

  3. Follow Installation Steps: Follow the on-screen instructions in the setup wizard. You can generally accept the default options unless you have specific preferences.

  4. Select Components: During installation, you may be asked to select components to install. Ensure that the "Install development headers and libraries for C and C++" option is checked if you plan to use ImageMagick with programming languages like C/C++.

  5. Choose Installation Directory: Choose the directory where you want to install ImageMagick. The default directory is usually fine for most users.

  6. Complete Installation: Once you've selected the options and installation directory, proceed with the installation process. After completion, you may be prompted to restart your computer, although this is not always necessary.

  7. Set System Path (Optional but Recommended): To use ImageMagick from the command line or in scripts, it's helpful to add the installation directory to your system's PATH environment variable. To do this:

    • Right-click on "This PC" or "My Computer" and select "Properties."
    • Click on "Advanced system settings" on the left-hand side.
    • In the System Properties window, click on the "Environment Variables" button.
    • In the Environment Variables window, select the "Path" variable under "System variables" and click "Edit."
    • Add the path to the ImageMagick installation directory (e.g., C:\Program Files\ImageMagick-7.0.11-Q16) to the list of paths, separated by semicolons.
    • Click "OK" to save your changes.
  8. Verify Installation: Open a command prompt and type magick -version to verify that ImageMagick is installed correctly. You should see information about the installed version of ImageMagick.

That's it! ImageMagick should now be successfully installed on your Windows system.

yejue commented 7 months ago

I'm sure I installed magic and verified it in the command line.

results follows:

C:\Users\Think>magick -version Version: ImageMagick 7.1.1-27 Q16-HDRI x64 0225ac4:20240121 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Channel-masks(64-bit) Cipher DPC HDRI Modules OpenCL OpenMP(2.0) Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg jxl lcms lqr lzma openexr pangocairo png ps raqm raw rsvg tiff webp xml zip zlib Compiler: Visual Studio 2022 (193732826)

Ilyes-El-Majouti commented 7 months ago

Install http://www.graphicsmagick.org/

oaxis commented 6 months ago

I'm getting the same error.

OS: Windows 11 Node : V16.19.0 Magick : V 7.1.1-27

Ignore the error in ImageMagick.:
Param�tre non valide - 200

Error:
Error: write EOF from ImageMagick
TypeError: this.listeners is not a function
    at Object.onerror (E:\*******\app-backend\node_modules\imagemagick-stream\index.js:274:16)
    at ImageMagick.imagemagickstream.onerror (E:\********\app-backend\node_modules\pdftopic\index.js:25:17)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[ERROR] 03:18:04 TypeError: this.listeners is not a function

According to Google results, it is because you spawn "convert", but on Windows "convert" is a system tool which converts FAT to NTFS.

I changed "convert" to "magick" in my local env and now I have another error.

magick: no images found for operation `-strip' at CLI arg 3 @ error/operation.c/CLIOption/5479.

So my guess is that its a problem with the magick version. If owner could recommend the Magick version he is using on Windows it would help.

Ilyes-El-Majouti commented 6 months ago

Thank you for solving a problem I will try with all the versions to see the most addapter for windows

Ilyes-El-Majouti commented 6 months ago

Install ghostscript https://www.ghostscript.com/index.html and the problem is solved

Ilyes-El-Majouti commented 6 months ago

It is all good ?