THotPDF.EndDoc Method

 

THotPDF.EndDoc

THotPDF

 

Top  Previous  Next

Closes the document

 

Delphi syntax:

procedure EndDoc;

 

C++ syntax:

void __fastcall EndDoc ( void );

 

Description

EndDoc finalises the current document, closes internal PDF objects, and writes the output file or stream

The limited Windows FPC NoGUI pure-PDF workflow described under BeginDoc can also finish empty pages and ordinary ASCII text-field documents, then start another independent document on the same instance

After writing, EndDoc releases the document's objects and registrations, so the same instance can start another independent document with BeginDoc. Property settings are kept, and CurrentPageNumber, PagesCount and the layout diagnostics of the written document remain readable until the next BeginDoc

 

During document finalisation HotPDF closes the active page and writes the final page content stream. If detailed page-content diagnostics are needed for this stage, enable PAGECONTENT_DEBUG_FILE in HotPDF.inc. This creates PageContent_Debug.txt with page-content merge and stream-size trace data. The switch is disabled by default, so normal builds do not create this file

 

General library debug logging is controlled separately by withDEBUG in HotPDF.inc, which writes HotPDF-Debug.log when enabled

 

Code Example


HPDF := THotPDF.Create( nil );
try
  HPDF.FileName := '.\Output.pdf';
  HPDF.BeginDoc;   // Start PDF document creation
  HPDF.CurrentPage.TextOut( 100, 100, 0, 'Hello World!' );
  HPDF.EndDoc;     // Finish and save PDF document
finally
  HPDF.Free;
end;

 

See also: BeginDoc