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 file is converted as a blank pdf and i got 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

Baran Toro
  • 19
  • 1
  • 1
    You will not be able to do this without some supporting library, unless you want to write your own PCL interpreter. – Pointy Jul 07 '23 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 – Baran Toro Jul 07 '23 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. – KenS Jul 07 '23 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. – KenS Jul 07 '23 at 16:30

0 Answers0