|
THotPDF.BeginDoc
|
Top Previous Next |
|
Creates new document.
Delphi syntax: procedure BeginDoc ( Initial: boolean = false );
C++ syntax: void __fastcall BeginDoc ( bool Initial = false );
Description BeginDoc starts a new PDF document and creates the first page. In normal usage, call BeginDoc with the default parameter value and then draw on CurrentPage. One THotPDF instance can write any number of documents, one after another. EndDoc writes the file and then drops everything registered for it: images, fonts, form fields, outlines, document JavaScript, named destinations, page labels, ICC profiles, output intents and the other resources. The written document's pages and objects stay in memory, so checks such as ValidatePDFUA2Structure still work after EndDoc, until the next BeginDoc frees them. The next document therefore starts clean, and no content of the previous file reaches it Properties such as FileName, Version, Compression, PDFACompliance, Author and Title keep their values for the next document, together with page layers, font fallback chains and variable-font axis selections. Anything registered after EndDoc and before the next BeginDoc, for example an output intent added with AddPDFAOutputIntent or a script added through Names, belongs to the next document. CurrentPageNumber, PagesCount and the layout diagnostics of the written document also stay readable until the next BeginDoc EndDoc clears UserPassword and OwnerPassword. When ActivateProtection is still on, set the passwords again before the next BeginDoc; otherwise BeginDoc raises an exception instead of writing a document protected by empty passwords. When a feature of one document raised the PDF version automatically (for example to PDF 1.4 for an output intent), EndDoc sets it back to the value of the Version property
Code Example
See also: EndDoc
|