Docs PDFiumVCL

PrintCopies property

Esta entrada API preserva identificadores, assinaturas, blocos de código e termos PDF em sua forma original.
Component: TPdf  ·  Unit: PDFium
Embedded suggested number of copies the PDF's author would like the print dialog to default to — the /NumCopies entry of the document's /ViewerPreferences dictionary.

Syntax

property PrintCopies: Integer; // read only

Description

PDFs may carry an advisory print preference recommending how many copies the print dialog should pre-populate. That preference lives in the catalog under /ViewerPreferences /NumCopies (PDF 32000-1 § 12.2 Table 150). PrintCopies exposes the decoded value: a positive integer when present, or 0 if the PDF leaves the field unset (in which case implementations should treat it as 1).

This is purely a hint baked into the file by the author; it has no effect on PDFium's rendering and does not influence how the document is rasterised. To actually print multiple copies your application still has to pass the count to its printing layer (Windows GDI StartDoc, a third-party print component, etc.).

The companion properties PrintScaling, PrintPaperHandling and PrintPageRanges expose the other viewer-preferences print hints in the same dictionary, so you can route them all into a print dialog at once. Use ViewerPreference['NumCopies'] for the raw string form if you need it.

Remarks

Example

// Pre-fill the spin edit with the document's suggested copies count.
var N: Integer;
begin
  N := Pdf1.PrintCopies;
  if N < 1 then N := 1;
  spinCopies.MinValue := 1;
  spinCopies.MaxValue := 999;
  spinCopies.Value := N;
  Memo1.Lines.Add(Format('PDF suggests %d copies', [N]));
end;

See Also

PrintScaling, PrintPaperHandling, PrintPageRanges, ViewerPreference