PDF Mosaic Library: Scoped parsing of PDF documents

Our library when you open and read pdf files using scoped parsing of document’s content. When opening a document, we extract the necessary minimum of pdf objects, and then in the process when applying to other objects we do parsing them. With this we were able to significantly reduce the time of opening and saving pdf documents, especially noticeable in the multi-pages if pdf documents. For example, the document, containing about 1300 pages, PDF Mosaic library opens for 1.5 seconds. PDF Mosaic library spends 40 seconds for saving the same document. Of course, time is approximate, since it depends on the machine on which conducted the tests, and the contents of pdf documents. But the advantages of deferred parsing clearly visible. But the advantages of delay parsing clearly visible.

If the processing time pdf documents is critical to you, or you mostly work with documents with many pages, we recommend to use the PDF Mosaic library, since this library is implemented effectively read of pdf documents.

The below a code for emulating and testing this situation:

using PDFMosaic;
using System;
 
namespace CreateAndSave
{
  class OpenAndSave
  {
    static void Main(string[] args)
    {
      // Open a big pdf file
      System.DateTime tmOpen = System.DateTime.Now;
      PDFDocument document = new PDFDocument(@"..\..\..\Adobe - Pdf Reference. 6th Ed.pdf");
      Console.WriteLine("Time spended for opening pdf file: {0} seconds", (System.DateTime.Now - tmOpen).Seconds);
 
      // Save opened file
      System.DateTime tmSave = System.DateTime.Now;
      document.Save("Adobe - Pdf Reference. 6th Ed - PDF Mosaic.pdf", true);
      Console.WriteLine("Time spended for saving pdf file: {0} minuts {1} seconds", (System.DateTime.Now - tmSave).Minutes, (System.DateTime.Now - tmSave).Seconds);
    }
  }
}

 

For example, compare the speed of PDF Mosaic library and iTextSharp. For testing we’ve using pdf with 1300 pages – Adobe PDF Reference.

The speed measurements were performed on computer has the fillowing configuration:

  • CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ 2.30 GHz;
  • RAM: 4,00 GB;
  • OS: Windows 7 x64.

And we’ve got the following results (Speedtest and Comparsion of Open-Source iTextSharp and PDF Mosaic Library):

  • PDFMosaic opens the file during 0.9 sec;
  • iTextSharp opens the file during 27.5 sec.