How to append postscript code to command line (-c)?

Feb 1, 2015 at 1:21 AM
Edited Feb 1, 2015 at 2:22 PM
Hi!

I've spent a few hours trying to get StartProcessing accept a "-c" command line switch but somehow, it always ends up in an -100 exception.

In general, I'm trying the following:
With cmdline
                .Add("-empty")
                .Add("-dNOPAUSE")
                .Add("-dBATCH")
                .Add("-dQUIET")
                .Add("-dSAFER")
                .Add("-dNOPROMPT")
                .Add("-q")
                .Add("-o test.tif")
                .Add("-sDEVICE=tiff24nc")
                .Add("-r600")
                .Add(" -c ""<</Install {-14 -14 translate}>> setpagedevice""")
                .Add("-fTEST.pdf")
End With
GSProc.StartProcessing(cmdline.ToArray(), Nothing)
But this always leads to an -100 exception unless I remove the -c part of the command line. Somehow I guess that it has something to do with the escaping of the quotation marks around the postscript code but I didn't find any other way to build the string.

Stepping through the code, I see that the string gets converted to
" -c \"<</Install {-14 -14 translate}>> setpagedevice\""
which seems to look absolutely okay when talking about C# ... but somehow, Ghostscript refuses to accept it that way.

Is there anything I can do?

Any help would be greatly appreciated ;-)

UPDATE: It seems that the quotation marks around the PS code are not necessary. So maybe I solved it for myself;-)
Coordinator
Feb 2, 2015 at 12:31 PM
This works:
    Sub Main()
        Dim gp As GhostscriptProcessor = New GhostscriptProcessor()
        Dim cmdline As List(Of String) = New List(Of String)

        With cmdline
            .Add("-empty")
            .Add("-dNOPAUSE")
            .Add("-dBATCH")
            .Add("-dQUIET")
            .Add("-dSAFER")
            .Add("-dNOPROMPT")
            .Add("-q")
            .Add("-sDEVICE=tiff24nc")
            .Add("-r600")
            .Add("-sOutputFile=E:\__test_data\out\test.tif")
            .Add("-c")
            .Add("<</Install {-14 -14 translate}>> setpagedevice")
            .Add("-f")
            .Add("E:\__test_data\in\test.pdf")
        End With

        gp.StartProcessing(cmdline.ToArray(), Nothing)
        gp.Dispose()
    End Sub
Cheers,
Josip
Feb 2, 2015 at 12:39 PM
Great!

As always, thanks for your fantastic work ;-)