Skip to content

Instantly share code, notes, and snippets.

@jcl86
jcl86 / CompressionExtensions
Created October 9, 2021 16:37
Compress pdf file with ghostscript
public static class CompressionExtensions
{
//The binaries of ghostscript should be included in the application directory to make this work, in this case gswin32c. (Only for windows)
public static void CompressPDF(string inputFile, string outPutFile, CompressionOption compressionOption = CompressionOption.Printer)
{
Process proc = new Process();
ProcessStartInfo psi = new ProcessStartInfo
{
CreateNoWindow = true,
ErrorDialog = false,