Linearisation with pdfDocument.Optimize();

Hello,

I hope this message finds you well. I am reaching out to discuss an issue we are experiencing with the linearization of PDF documents using your pdfDocument.Optimize() method. According to the instructions provided on your website, we have followed the necessary steps for linearization, and we have verified that the Fast Web View flag is set to true. However, we are not observing any improvements in the document load times when accessed over the web.

For your reference, we have tested this using the Aspose PDF Viewer to load content from SharePoint, and we have also observed the same issue with other PDF viewers over the web.

To mitigate this issue temporarily, we have utilized a free third-party library to linearize the document, which has resulted in improved load times. However, we would like to emphasize that Encodian Solutions Ltd, the company I am representing, holds a full Aspose license. We would prefer to leverage the capabilities of your software to address this issue, as opposed to introducing an additional library to our tech stack.

To further illustrate this issue, I have developed a demo application, which I have detailed below. The document used for testing was over 500MB in size.

using Aspose.Pdf;

namespace PdfLinearizer
{
    class Program
    {
        static void Main()
        {
            string inputPath = @"D:\640MB.pdf";
            string outputPath = @"D:\640MB_Linearized.pdf";
            
            try
            {
                // Open document
                using (Document pdfDocument = new Document(inputPath))
                {
                    // Optimize for web
                    pdfDocument.Optimize();

                    // Save output document
                    pdfDocument.Save(outputPath);
                }

                Console.WriteLine($"Linearized PDF saved to {outputPath}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"An error occurred: {ex.Message}");
            }
        }
    }
}

We would greatly appreciate your assistance in resolving this matter at your earliest convenience.

Thank you,

Al Hawkins-Cole
Principle Developer
Encodian Solutions Ltd

@alcole444

Thanks for contacting support. Would you kindly share your sample PDF document with us by uploading it to Google Drive or Dropbox? We will test the scenario in our environment and address it accordingly.

You can also try to use Document.OptimizeResources method and check if it improves the document loading time.