Maximum PDF Compression with Minimal Effort

Maximum PDF Compression with Minimal Effort

Published November 30, 2023

Shrink PDFs with Ease using Adobe PDF Library 

You’ve probably seen much of our content discussing the importance of PDF optimization and compression. That’s because we are passionate about making sure our software can help our customers achieve the best compression with as little effort as possible. Think of us as an all-powerful shrink-ray for your PDFs! 

sddefault.jpg

 

The PDF Optimizer API of the Adobe PDF Library(C++, C#, and Java), which holds all of this impressive PDF compression technology, has seen its fair number of improvements over the years, and with those updates, we have released the compression power that was once hidden and only readily accessible to the PDF experts out there who knew which knobs to turn. 

These days, you don’t have to be a PDF expert to experience the power of maximum compression, and you can get great compression results ‘out of the box’ without having to tweak any settings. In other words, you can get the best results without having to be bogged down with knowing PDF technical details. Huzzah!

Read PDF Optimization: When Size Isn't the Only Thing That Matters 

About our PDF Compression Technology 

As part of this compression-driven focus, we have been able to deliver three compression-focused profiles known as compressionLow, compressionMedium, and compressionHigh. The Medium profile is your best bet to get great compression results across just about any kind of PDF document. It’s the profile to use if you’re not sure exactly which settings you need other than great compression.  It makes very smart choices about where you can trade-off some loss for substantial file size compression.  The Low profile is best suited to users who need moderate compression but can’t afford much loss.  The High profile is best suited to users who need the maximum possible compression and are ready to accept modest losses.

When we say ‘loss,’ we mean that there is some information in a PDF that can be inconsequential to visual fidelity and cross-compatibility that during compression, you are technically losing, but the document remains the same in terms of what you see and what you can do with it.  There are other types of information in a PDF, particularly in images, that can be compressed in a lossy fashion (meaning there is some loss of information or richness of pixel information) but to the human eye the loss is barely noticeable.  Knowing this, we can take steps to modify a PDF to substantially reduce its size. 

If you want to learn more about lossy vs lossless PDF compression, as well as our three levels of compression, check out our blog PDF Compression: Profiles & Benefits.”

During our research and development phase, we decided to test the competition (including competitors’ SDKs, applications, and online services) and are very proud to say we’re delivering the best PDF compression technology available on the market today.  We took a collection of various PDFs featuring different challenges (different page counts, file sizes, compression levels, PDF features, PDF versions, etc.) and ran them through our previous public release.  We then worked step-by-step on improvements, and the result is in aggregate a 20% improvement using the Medium profile.  Individually, however, results can become even better. Some files that were previously uncompressible are now compressible by over 90%!

The real beauty of this compression power is that it’s fully customizable! If you need to target more aggressive compression or removal options in one scenario you can do so, and in a different scenario you can target more modest settings.  This is easy to do with clearly labeled API options at the programmatic level. 

PDF Compression Example

Let’s look at an example of how our compression works in Adobe PDF Library by checking out some sample code for .NET:

namespace PDFOptimize

{

    class Optimize

    {

        static void Main(string[] args)

        {

            Console.WriteLine("PDF Optimizer:");

 

 

            using (new Library())

            {

                Console.WriteLine("Initialized the library.");

 

                String sInput = Library.ResourceDirectory + "Sample_Input/sample.pdf"; ;

                String sOutput = "../PDFOptimizer-out.pdf";

 

                if (args.Length > 0)

                    sInput = args[0];

 

                if (args.Length > 1)

                    sOutput = args[1];

 

                Console.WriteLine("Input file: " + sInput);

                Console.WriteLine("Writing to output " + sOutput);

 

                using (Document doc = new Document(sInput))

                {

                    using (Datalogics.PDFL.PDFOptimizer optimizer = new Datalogics.PDFL.PDFOptimizer())

                    {

                        long beforeLength = new System.IO.FileInfo(sInput).Length;

 

                        optimizer.Optimize(doc, sOutput);

 

                        long afterLength = new System.IO.FileInfo(sOutput).Length;

 

                        Console.WriteLine();

                        Console.WriteLine("Optimized file: {0:P2} the size of the original.", (double)afterLength / beforeLength);

 

To see this amazing PDF compression shrink-ray in action, all you have to do is download a trial of Adobe PDF Library - it’s free! Get started on your journey to shrink your PDFs today.