API referenceImport & Output APIs

pdfCloseFile

Serialize and finish the document.

Exported namespdfCloseFile

Purpose — Serialize and finish the document.

Description — Runs the full serialization pipeline (font subsetting and embedding → images/templates/annotations/fields/outlines → optional encryption → xref + trailer) and closes the output. Only a TRUE return guarantees a complete file on disk (or a complete memory buffer). The instance returns to idle and can open a new document.

C
BOOL32 __stdcall pdfCloseFile(PPDF IPDF);
Delphi
function pdfCloseFile(const IPDF: PPDF): LongBool; stdcall; external 'LumasPdf.dll';

Return valueTRUE on success; on FALSE, drain the error log — the output must be considered unusable.

See alsopdfCloseFileEx, pdfGetBuffer

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Import & Output APIs
Category

Core

Exported names

pdfCloseFile

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.