You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Enable image compression and set the image quality
33
+
options.CompressImages=true;
34
+
options.ImageQuality=50;
35
+
36
+
// Enable font optimization
37
+
options.OptimizeFont=true;
38
+
39
+
// Enable page content optimization
40
+
options.OptimizePageContents=true;
41
+
42
+
// Remove metadata from the PDF
43
+
options.RemoveMetadata=true;
44
+
45
+
// Compress the PDF document
46
+
loadedDocument.Compress(options);
47
+
48
+
// Save the document into a memory stream
49
+
using (MemoryStreamoutputStream=newMemoryStream())
50
+
{
51
+
loadedDocument.Save(outputStream);
52
+
}
53
+
}
54
+
}
51
55
```
52
56
53
57
You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Compression/Compress-the-existing-PDF-document).
0 commit comments