Hi
Im trying to use the GS.Net library to reduce a load of PDF files programmatically. It finds the PDF (it has the correct number of pages but no new pdf is written to the dir). What am i dooing wrong? I get no exceptions.
Code:
"C:\Program Files (x86)\gs\gs9.14\bin\gswin32c" -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=E:\OPD\038612_2_org_ebook_code_2.pdf E:\OPD\038612_2_org.pdf
Anyone got a tip?
BR
/Per
Im trying to use the GS.Net library to reduce a load of PDF files programmatically. It finds the PDF (it has the correct number of pages but no new pdf is written to the dir). What am i dooing wrong? I get no exceptions.
Code:
internal class Program
{
private static void Main(string[] args)
{
const string InputFile = @"E:\OPD\038612_2_org.pdf";
const string OutputFIle = @"E:\OPD\038612_2_org_ebook-code_1.pdf";
var gsVersionInfo = GhostscriptVersionInfo.GetLastInstalledVersion(GhostscriptLicense.GPL | GhostscriptLicense.AFPL, GhostscriptLicense.GPL);
using (var gsProcessor = new GhostscriptProcessor(gsVersionInfo, true))
{
gsProcessor.Processing += ProcessorProcessing;
var switches = GetGsSwitches(InputFile, OutputFIle);
gsProcessor.StartProcessing(switches.ToArray(), null);
}
}
private static List<string> GetGsSwitches(string inputFile, string outputFile)
{
var switches = new List<string>
{
"-sDEVICE=pdfwrite",
"-dCompatibilityLevel=1.4",
"-dPDFSETTINGS=/ebook",
"-dNOPAUSE",
//"-dQUIET",
"-dBATCH",
@"-sOutputFile=" + outputFile,
inputFile
};
return switches;
}
static void ProcessorProcessing(object sender, GhostscriptProcessorProcessingEventArgs e)
{
Console.WriteLine(e.CurrentPage + " / " + e.CurrentPage);
}
}
GS console line used, which reduces the original PDF and saves the new PDF to disk:"C:\Program Files (x86)\gs\gs9.14\bin\gswin32c" -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=E:\OPD\038612_2_org_ebook_code_2.pdf E:\OPD\038612_2_org.pdf
Anyone got a tip?
BR
/Per