1. Computing

PDF Linearization with Delphi - Optimize PDF Documents for "Fast Web View" with Delphi

By April 22, 2009

Follow me on:

in Delphi does PDF :: Linearized PDF document - fast web view for PDF files from Delphi code A linearized PDF file is a PDF file that is structured in a way that allows the first page of the PDF file to be displayed in a user Web browser before the entire file is downloaded from a server. From a practical point of view this means that a Linearized PDF opens instantly rather than requiring that the entire PDF is downloaded before it can be seen. This is especially important with large documents that can take a long time to download from a server.

Adobe sometimes refers to Linearization as Fast Web View.

While there are many Delphi controls and libraries that allow creating and manipulating PDF documents, only a few have an option to linearize an existing (or new) PDF document.

One such library that supports linearizing (or optimizing for "Fast Wev View") is VersyPDF. Using VersyPDF libraries you can write stand-alone, cross-platform applications that can read, write, and edit PDF documents.

Linearization in VersyPDF is as simple as:

var
  versyPDFDoc : TPDFDocument;
  versyPDFLib : TPDFLibrary;
begin
  versyPDFLib := TPDFLibrary.Create('','');
  versyPDFDoc := TPDFDocument.Create(versyPDFLib);
  try
    versyPDFDoc.LoadFromFile('non-linearized.pdf');
    versyPDFDoc.Linearized := true;
    versyPDFDoc.SaveToFile('linearized.pdf');
  finally
    versyPDFDoc.Free;
    versyPDFLib.Free;
  end;
end;

Related:

Comments
Comments are closed for this post.
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.