[Solved] Ghostscript - write files

How can i use ‘pdf writer’ to write files with ghost script?

What is the

  • input file format and
  • expected file format?

“PDF” not really an answer of any of this questions. Which PDF version, what color space? Which compatibility level? Etc.

And what do you meant under “pdf writer”? You mean how to use GS in command line, or if gs can be used as an addon/translator in Haiku?

I want to merge pdf files to one file using ghostscript in terminal.

In the command line, i found to do this, is set a device: pdfwriter but it is not available in haiku.

I can post the command line late, then I am back from work

This command works for me on 64 bit Haiku with ghostscript_gpl-9.50-2-x86_64.hpkg:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=output.pdf -dBATCH input_1.pdf input_2.pdf

I think you made a typo.

Also possible you are using GS 8.x on 32 bit and maybe, just maybe that built differently. Make sure you use GS 9.x.

Hello extrowerk

thanks for the infos. I have AFPL Ghostscript 8.14 (2004-02-20) on 32bit Haiku.

My Test: two pdf files merging to one file. I get the error: AFPL Ghostscript 8.14: Unrecoverable error, exit code 1

There is no higher version of Ghostscript available on HaikuDepot.

9.x should be available:
image

Get it running, thanks

Is the syntax of gs on Haiku different to Linux?

I tried to split a pdf into single pages but it does not run:

gs -sDEVICE=pdfwrite -dSAFER -o outname.%d.pdf input.pdf

Command -o does not exist on Haiku, so i use -

-sOUTPUTFILE=outname.%d.pdf

The manpage for Linux doesn’t mention a -o option: https://linux.die.net/man/1/gs

I don’t know which version you are using on Linux?

I mean the descriptions on the Internet coming from Linux. I use haiku and i want to do it with haiku.

The -o option is in the official documentation:

-o option:

As a convenient shorthand you can use the -o option followed by the output file specification as discussed above. The -o option also sets the -dBATCH and -dNOPAUSE options. This is intended to be a quick way to invoke ghostscript to convert one or more input files.

For instance, to convert somefile.ps to JPEG image files, one per page, use:

gs -sDEVICE=jpeg -o out-%d.jpg somefile.ps

is equivalent to:

gs -sDEVICE=jpeg -sOutputFile=out-%d.jpg -dBATCH -dNOPAUSE somefile.ps

Source: https://www.ghostscript.com/doc/current/Use.htm#o_option

Then you should :

  • test it on linux
  • and if it differs ask the Ghostscript developers, because there is nothing fancy in the recipe, it should work on Haiku just like on every other platform.

I get the problem fixed. We have a 10 years old ghostscript version on HaikuDepot. I install now version 9.x and splitting of pdf are possible.

2 Likes