Performance
One of the big factors when working with any external file is performance, its one thing to be able to deal with a couple of marketing PDFs, but something totally different when you start processing files containing many hundreds of megabytes. In the new v14.2 release the team revisited the speed of the PDF engine , optimizing the way documents are loaded. The following example is based on a 60,000 page PDF (800mb) document
| v14.1 | v14.2 | Chrome | Adobe |
Load Time (seconds) | 35 | 6 | 12 | 1 |
| 1.1GB |
| 1.1GB | 120MB |
You can see from the table that there are significant performance gains in terms of speed and memory consumption, so how was this achieved? In previous versions of the PDF engine after setting the DocumentFilePath (or DocumentSource property), it was guaranteed that all input operations would be fully completed, this was the major factor causing low performance. The file would be read in it's entirety before returning to the control. The new v14.2 engine will lock the file for the time it is open, replicating the same behaviour used by Adobe Reader and allowing for the much improved metrics. If however you need to retain the older methods (no file locking), there is a new property available in the PDF Viewer – DetachStreamAfterLoadComplete, and an overload method for the PDF Document Processor – LoadDocument – detachStreamAfterLoadComplete as the second parameter.
Print Preview Dialog
Another frequently requested feature was advanced printing, v14.2 implements some amazing updates to the print preview system. A new print dialog has been introduced that boasts a full set of options for printing documents.
The first thing to notice is the real time preview window, showing exactly what you are going to print. The pager control will allow you to step through just the pages that will be included in the print and how it will look on paper. The print dialog allows granular control over ever aspect of the output.
Page range selection can include a set of pages such as 2-5 which would include page 2 through to page 5, you can also stipulate the order of pages, so 2-5,1,6 would print pages 2-5 then page 1 followed by page 6.
There is an option to fit to page, actual size or custom page scaling.
Page orientation can be forced to portrait or landscape, alternately you can tell the printing system to auto calculate the orientation. If the scaling option is set to ‘fit to page’ and orientation is set to ‘auto’ the print engine will attempt to set the orientation and scaling to maximize the most of the available paper size.
Another new addition to the printing system is the control over DPI output. With v14.2 you have full management over the quality and performance by controlling the print density via the DPI parameter.
Of course, all of these features are available in the WinForms and WPF PDF Viewers or via the PDF Viewer API.
If you have any comments or questions, please feel free to contact me!
Paul Usher
Email: paulu@devexpress.com
Twitter: @dxAustralia