A similar product takes a 12mb file down to 1.5 mb where your product is leaving it a 12mb.a similar product takes a 12mb file down to 1.5 mb where your product is leaving it a 12mb.
Following code did not help.
// load source PDF file
Document doc = new Document(@"d:\document.pdf");
doc.OptimizeResources(new Document.OptimizationOptions(){
LinkDuplcateStreams=true,
RemoveUnusedObjects=true,
RemoveUnusedStreams=true});
// save output file
doc.Save(@"d:\outFile.pdf");
Hi Mike,
Thanks for contacting support.
One way of compression the PDF file size is to compress the images (change their type) within the PDF document. Please try using the following code snippet to accomplish your requirement.
[C#]
Document pdfDocument = new Aspose.Pdf.Document(“c:/pdftest/Memory+Test.pdf”);<o:p></o:p>
foreach (Page page in pdfDocument.Pages)
{
int idx = 1;
foreach (Aspose.Pdf.XImage
image in page.Resources.Images)
{
using (var
imageStream = new MemoryStream())
{
image.Save(imageStream,
System.Drawing.Imaging.ImageFormat.Png);
imageStream.Seek(0, SeekOrigin.Begin);
page.Resources.Images.Replace(idx, imageStream);
}
idx =
idx + 1;
}
}
pdfDocument.Save(“c:/pdftest/Compressed_output.pdf”);
In case you still face the issue, please share the resource PDF file so that we can test the scenario at our end. We are sorry for your inconvenience.