THotPDF.EndDoc Method

 

THotPDF.EndDoc

THotPDF

 

Top  Previous  Next

Closes the document.

 

Delphi syntax:

procedure EndDoc;

 

C++ syntax:

void __fastcall EndDoc ( void );

 

Description

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

After writing, EndDoc drops the images, fonts, form fields and other resources registered for the document, so the same instance can start another independent document with BeginDoc. Property settings are kept. The written document's objects, CurrentPageNumber, PagesCount and layout diagnostics remain available for inspection, for example with ValidatePDFUA2Structure, until the next BeginDoc frees them

 

During document finalization 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