AuditDocumentSpace

Document properties, Optimisation

Description

Breaks the selected document's byte usage down by object category, answering why a file is as large as it is.

Syntax

Delphi

Function TPDFlib.AuditDocumentSpace: Integer;

Return values

0No document is selected.
IDA string list handle for GetStringListCount and GetStringListItem; release it with ReleaseStringList.

Remarks

The report holds one Category,Objects,Bytes,Percent line per category after a Total,Objects,Bytes,100.0 summary line. The fixed category order is: Images, Font programs, Font dictionaries, Content streams, Form XObjects, Object streams, Embedded files, Metadata, Structure tree, Annotations, Page tree, Other.

Byte counts reflect the stored size of each indirect object; members of compressed object streams count zero bytes because their storage already belongs to the Object streams category. Classification uses both the objects themselves and their referencing context, so content streams, font programs and page thumbnails land in their own categories rather than in Other. A dominant Images share points at DownsampleImages, a dominant font share at SubsetEmbeddedFonts, and uncompressed content at CompressContent.

Example

ListID:= PDF.AuditDocumentSpace;
for I:= 1 to PDF.GetStringListCount(ListID) do
  Memo1.Lines.Add(PDF.GetStringListItem(ListID, I));
PDF.ReleaseStringList(ListID);

See also

AnalyseFile, DownsampleImages, SubsetEmbeddedFonts, GarbageCollectObjects