1

I have to convert pcl file into a pdf file using Node JS but i don't know how to do that any help will be great.

I just installed GhostScript via home brew then run the command:

 gs -sDEVICE=pdfwrite -o output.pdf input.pcl

but the file is converted as a blank pdf and I got a few errors as follows:

Error: /undefined in E3F1241s1754T75Rl0E6W
Operand stack:
Execution stack:
 %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
 --dict:765/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Current file position is 37
GPL Ghostscript 10.01.2: Unrecoverable error, exit code 1

What is the best approach converting pcl file into a pdf file using node js without using third party API's if possible?

I tried the use ghostscript 10.01.2

K J
12.7k6 gold badges28 silver badges77 bronze badges
asked Jul 7, 2023 at 13:23
4
  • 1
    You will not be able to do this without some supporting library, unless you want to write your own PCL interpreter. Commented Jul 7, 2023 at 13:34
  • what libraries i can use for it? I have been working on the same task for a long time i'm bit confused Commented Jul 7, 2023 at 13:42
  • 1
    Ghostscript doesn't interpret PCL, it only interprets PostScript and PDF. If you want to interpret PCL then you need a PCL interpreter, such as GhostPCL. I don't think you stand much hope of taking a PCL file and turning it into a PDF file using JS alone unless you are prepared to learn two complete Page description languages (PCL and PDF) and write thousands of lines of code to interpret the PCL and generate equivalent PDF marking operations from it. In fact, because of rasterOps, it is only possible to guarantee a correct conversion by rendering to an image and making a PDF from that. Commented Jul 7, 2023 at 13:56
  • 1
    GhostPCL isn't commercial, it's open source. The PCL font set is (unfortunately) not under the AGPL, but a more restrictive license (AFPL). You can use them in an open source environment, but not commercially without a commercial license. Sadly this was negotiated long ago, when the open source world was a different place and the font vendor has since been acquired by a competitor, there is now no possibility of altering the license of the PCL fonts. Commented Jul 7, 2023 at 16:30

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.