0

When I try to remove Creator, Author, Subject, Title and Keywords from a PDF using Ghostscript.NET, I get the error -100.

Here are the switches I am using:

var switches = new List<string> 
{ 
"-dBATCH", 
"-dNOPAUSE", 
"-sDEVICE=pdfwrite", 
"-c", 
"\"[/Creator()/Author()/Subject()/Title()/Keywords() /DOCINFO pdfmark\"", 
$"-sOutputFile={pdfOutput}", 
pdfInput 
};

THANKS

Fernando Silva
  • 334
  • 6
  • 16

1 Answers1

1

You should read the back channel output to see the error messages and report those.

I can see several problems here, the first being that you have introduced PostScript using the -c switch, but not terminated it with the -f switch. This means that everything following the -c is interpreted as PostScript, -sOutputFile=... is not valid PostScript and will throw a syntax error.

You have created the PDF file, then set its DOCINFO to (), then interpreted a PDF file. The act of interpreting the PDF file will set the DOCINFO from the input file Info dictionary, so handily overwriting your empty strings. You need to set the Info dictionary entries after you have interpreted the PDF file, not before. So the -c "..../DOCINFO pdfmark" -f should come after the input file, not before it.

KenS
  • 30,202
  • 3
  • 34
  • 51