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
  • 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 '18 at 8:52
  • The problem is, that the arara-rule does not work, since update on version 4. – cis Nov 12 '18 at 11:33
  • @cis I wrote a new rule based on the one you provided, please take a look if it works. – Paulo Cereda Nov 12 '18 at 11:54
  • @PauloCereda OK. – cis Nov 12 '18 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 '18 at 12:14
3

This 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(file) + '.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 , "-%d" );
    }
- 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(file);
    }
- 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.