I have a pdf
template of size 230KB. In my WebAPI
for multiple users, taking copy of that template pushing data to it, and merging using iTextsharp
library. For 1500 users, total file size is reaching up to 320 MB.
I tried using BitMiracle
, it reduced the file size to 160 MB. But it is still a large file.
I used acrobat Pro
and used Save as Other
option Reduced Size PDF
, it reduced file size to 25 MB.
I want to decrease the file size to 25MB in my WebAPI using C#
which will be hosted on server later.
As user is not supposed to edit that PDF
, he will just store it as a record. Can i generate a post script file and then use acrobat distiller to decrease the size?If yes, how can I do it?
I am using ghostscript.Net
. Wrote this method, it is not throwing any error. But i am unable to find the path of generated postscript file
public void convertToPs(string file)
{
try
{
Process printProcess = new Process();
printProcess.StartInfo.FileName = file;
printProcess.StartInfo.Verb = "printto";
printProcess.StartInfo.Arguments = "\"Ghostscript PDF\"";
printProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
printProcess.StartInfo.CreateNoWindow = true;
printProcess.Start();
// Wait until the PostScript file is created
try
{
printProcess.WaitForExit();
}
catch (InvalidOperationException) { }
printProcess.Dispose();
}
catch (Exception ex)
{
throw ex;
}
}
Please help