I am using the below code to optimize (shrink) existing large PDF files in VS2012 using vb.net:
Dim aspDoc As New Aspose.Pdf.Document(strFN)
Dim optVals As New Aspose.Pdf.Document.OptimizationOptions
optVals.CompressImages = True
optVals.ImageQuality = 22
optVals.RemoveUnusedObjects = True
optVals.RemoveUnusedStreams = True
optVals.LinkDuplcateStreams = True
aspDoc.OptimizeSize = True
Try
aspDoc.OptimizeResources(optVals)
Catch ex As Exception
MsgBox(“Error optimizing resources!”, MsgBoxStyle.Exclamation, “”)
End Try
aspDoc.Save(strFN)
aspDoc.Dispose()
GC.Collect()
aspDoc = Nothing
GC.Collect()
It works just fine on the 1st PDF file, shrinks down from 50+ MB to 5 MB but throws an OUT OF MEMORY exception on any subsequent attempts on other PDF files of the same magnitude during the same run-time session. So only the 1st large PDF file gets optimized without error. See below error:
When I check performance in task manager it shows 5.38 GIG used out of 8 GIG total usuable memory. Why?
Hi Michael,
Please use ftp to download the large PDF file as follows;
Host: ftp.linkproducts.ca
Username: asposesupport
Password: aspose001
Let me know if any issues.
Also
look forward to a solution as we purchased the license for this very
purpose and only this purpose (for now). If we cannot use it we spent
the $$$ for nothing. I did test it before purchasing but did not expect
such a situation.
Thanks
Michael Margulies
Hi Michael,
Hi Michael,
Hmmmm, I since rebooted my computer and tried again and it is working fine now.
Thanks for your help anyways.
Hi
Hi Michael,