2

I have the arara rule ghostscript.yaml written by @clemens and @esdd and some lints added by myself, which converts pdf-files into graphic files, like png, using ghostscript.

I set up TeXLive 2018. My old arara rules do not work any more.

I tried the rule converter rc.jar without succes.

What have I to do?

!config
# GhostScript rule for arara
# author: Clemens Niederberger, Elke Schubert
# version: 0.4b 2014/30/06
# requires arara 3.0+
identifier: ghostscript
name: GhostScript
command: <arara> @{program} @{options} -r@{resolution}
        -sDEVICE=@{device} -dGraphicsAlphaBits=@{alphabits} -dTextAlphaBits=@{alphabits}
        -sOutputFile=@{outputfilename}@{allpages}.@{format} @{getBasename(file)}.pdf
arguments:
- identifier: program
  flag: <arara> @{parameters.program}
  default: <arara> @{ isWindows("gswin32c", "gs") }
- identifier: options
  flag: <arara> @{parameters.options}
  default: -q -dNOPAUSE -dBATCH  -dEPSCrop
- identifier: allpages
  flag: <arara> @{ isTrue( parameters.allpages , "-%d" ) }
- identifier: resolution
  flag: <arara> @{parameters.resolution}
  default: 300
- identifier: device
  flag: <arara> @{parameters.device}
  default: png16m
- identifier: alphabits
  flag: <arara> @{parameters.alphabits}
  default: 4
- identifier: outputfilename
  flag: <arara> @{parameters.outputfilename}
  default: <arara> @{getBasename(file)}
- identifier: format
  flag: <arara> @{parameters.format}
  default: png
8
  • 1
    What is the problem? Transparency not conveyed during conversion? Then add -dNOSAFER to the gs options. See tex.stackexchange.com/a/453786
    – AlexG
    Nov 12, 2018 at 8:52
  • The problem is, that the arara-rule does not work, since update on version 4.
    – cis
    Nov 12, 2018 at 11:33
  • @cis I wrote a new rule based on the one you provided, please take a look if it works. Nov 12, 2018 at 11:54
  • @PauloCereda OK.
    – cis
    Nov 12, 2018 at 11:58
  • @PauloCereda I think your convertet rule will work fine. So I guess it is ok. I have amother problem, based on ghostscript itself, after updating TeXLive2018 I get GPL Ghostscript 9.25: Can't find initialization file gs_init.ps - I think I have to solve that, if I can.
    – cis
    Nov 12, 2018 at 12:14

1 Answer 1

3

alThis is my personal take at this particular rule conversion:

File ghostscript.yaml:

!config
identifier: ghostscript
name: GhostScript
commands:
- name: The application
  command: >
    @{
         return getCommand(program, options, '-r' + resolution, '-sDEVICE=' + device,
                '-dGraphicsAlphaBits=' + alphabits, '-dTextAlphaBits=' + alphabits,
                '-sOutputFile=' + outputfilename + allpages + '.' + format,
                getBasename(reference) + '.pdf');
    }
arguments:
- identifier: program
  flag: >
    @{
        return parameters.program;
    }
  default: >
    @{
        return isWindows("gswin32c", "gs");
    }
- identifier: options
  flag: >
    @{
        return parameters.options;
    }
  default: >
    @{
        return [ '-q', '-dNOPAUSE', '-dBATCH', '-dEPSCrop' ];
    }
- identifier: allpages
  flag: >
    @{
        return isTrue( parameters.allpages , "-%03d" );
    }
- identifier: resolution
  flag: >
    @{
        return parameters.resolution;
    }
  default: 300
- identifier: device
  flag: >
     @{
        return parameters.device;
     }
  default: png16m
- identifier: alphabits
  flag: >
    @{
        return parameters.alphabits;
    }
  default: 4
- identifier: outputfilename
  flag: >
    @{
        return parameters.outputfilename;
    }
  default: >
    @{
        return getBasename(reference);
    }
- identifier: format
  flag: >
    @{
        return parameters.format;
    }
  default: png

My test:

$ arara -n test.tex 
  __ _ _ __ __ _ _ __ __ _ 
 / _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
 \__,_|_|  \__,_|_|  \__,_|

Processing 'test.tex' (size: 21 bytes, last modified: 11/12/2018
09:35:42), please wait.

[DR] (GhostScript) The application
-----------------------------------------------------------------
Authors: No authors provided
About to run: [ gs, -q, -dNOPAUSE, -dBATCH, -dEPSCrop, -r300,
-sDEVICE=png16m, -dGraphicsAlphaBits=4, -dTextAlphaBits=4,
-sOutputFile=test.png, test.pdf ]

Total: 0.41 seconds
3
  • Please note it should be reference from version 5.0 on (which works in version 4 as well).
    – TeXnician
    Apr 11, 2020 at 17:12
  • I fine-tuned "-%d" to "-%03d" so you get, using the option allpgages: true, files -001, -002, ..., -010, -011,... instead of -1, -2,..., -10, -11,... See here: ghostscript.com/doc/current/Use.htm
    – cis
    Sep 8, 2020 at 12:24
  • And I changed 'file' to 'refrence' due to v5.0 as @TeXnician notes.
    – cis
    Sep 8, 2020 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .