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
-
1You will not be able to do this without some supporting library, unless you want to write your own PCL interpreter.Pointy– Pointy2023年07月07日 13:34:49 +00:00Commented 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 confusedBaran Toro– Baran Toro2023年07月07日 13:42:50 +00:00Commented Jul 7, 2023 at 13:42
-
1Ghostscript 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– KenS2023年07月07日 13:56:43 +00:00Commented Jul 7, 2023 at 13:56
-
1GhostPCL 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– KenS2023年07月07日 16:30:57 +00:00Commented Jul 7, 2023 at 16:30