Hello!
I'm trying to compress pdfs using spire and I can't get it to compress the size.
If I compress the document through an external online page I see that it is reduced by half.
I have to generate a word, save it as pdf but compressed.
My code is similar to the next code more or less:
Document _documentFile = new Document("WordDocument.docx");
//-->change de _documentFile
//ff is the final format
_documentFile.IsUpdateFields = true;
if(ff== Spire.Doc.FileFormat.PDF)
{
MemoryStream temp = new MemoryStream();
_documentFile.SaveToStream(temp, ff);
PdfDocument pdfdoc = new PdfDocument(temp);
pdfdoc.FileInfo.IncrementalUpdate = false;
pdfdoc.CompressionLevel = PdfCompressionLevel.Best;
pdfdoc.SaveToStream(fileStream);
//FileStream have the same size with compression or without compression, but, if I use an external page the file is reduced to less than half
//if I try to use the TryCompressImage function, the application is blocked
}
else
{
_documentFile.SaveToStream(fileStream, ff);
}
How could I do this to make it work?
Thank you!