Hi, i hope someone can help me.
The cloud app have a setup where you can choose between Low, Medium and high
Though the Aspose.pdf framework its self does not these direct options, but more defined options under OptimiseResources.
But I really want to recreate these options, so i have to make the right selections under OptimizationOptions.
The Medium and High was pretty easy to figure out due to the description but the low i am more uncertain of
The “Low” compression mode optimizes the internal structure of the document and removes redundant metadata from the PDF document.
The “Medium” mode performs the same actions as the “Low” compression mode and additionally reduces the quality of images within the document by 50%.
When using the “High” compression mode PDF of the document, images are compressed by 75% and the maximum resolution for images will be 150px.
What is the “optimize the internal structure and remove redudant metadata”?
The code i am currently using is
var optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
optimizationOptions.AllowReusePageContent = true;
optimizationOptions.RemoveUnusedObjects = true;
optimizationOptions.RemoveUnusedStreams = true;
optimizationOptions.RemovePrivateInfo = true;
optimizationOptions.LinkDuplcateStreams = true;
optimizationOptions.SubsetFonts = true;
optimizationOptions.UnembedFonts = true;
pdfDocument.Optimize();
if (level.Value == EditManipulatePDF.CompressLevels.Medium || level.Value == EditManipulatePDF.CompressLevels.High)
{
optimizationOptions.ImageCompressionOptions.CompressImages = true;
if (level.Value == EditManipulatePDF.CompressLevels.Medium)
optimizationOptions.ImageCompressionOptions.ImageQuality = 50;
else if (level.Value == EditManipulatePDF.CompressLevels.High)
{
optimizationOptions.ImageCompressionOptions.ImageQuality = 25;optimizationOptions.ImageCompressionOptions.ResizeImages = true; optimizationOptions.ImageCompressionOptions.MaxResolution = 150; }
}
pdfDocument.OptimizeResources(optimizationOptions);
When i do a Compress with this code and a compress with the code from the link above, it does not entirely match. It is close but it is off with a few bytes so I know its not entirely right