Accusoft.PdfXpress7.Net
Compress a Document

PDF Xpress™ supports compressing existing documents.

The following is an example in which a PDF document is opened and then saved to disk. Compression is enabled by specifying it in the SaveOptions properties. PDF Xpress attempts to compress the document, if possible. Options for compression are controlled by specifying the CompressOptions property of SaveOptions.

C#
Copy Code
using Accusoft.PdfXpressSdk;
namespace Compress
{
    class Program
    {
        static void Main(string[] args)
        {
            using (PdfXpress pdf = new PdfXpress())
            {
                pdf.Initialize();
                using (Document doc = new Document(pdf, "document.pdf"))
                {
                    SaveOptions saveOptions = new SaveOptions();
                    saveOptions.Compress = true;
                    saveOptions.Linearized = true;
                    saveOptions.Overwrite = true; 
                    saveOptions.Filename = "Compressed.pdf";
                    doc.Save(saveOptions);
                }
            }
        }
    }
}

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback