unit Chilkat.Pdf;

{
  Pascal wrapper for Chilkat Pdf.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TPdf wraps CkPdf via the C bridge layer. }
  TPdf = class(TChilkatBase)
  private
    FOnAbortCheck: TChilkatAbortCheckEvent;
    FOnPercentDone: TChilkatPercentDoneEvent;
    FOnProgressInfo: TChilkatProgressInfoEvent;
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetNumSignatures: Integer;
    function  GetNumPages: Integer;
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
    function  GetSigAllocateSize: Integer;
    procedure SetSigAllocateSize(AValue: Integer);
    function  GetNumEmbeddedFiles: Integer;
    function  GetHasCertificationSig: Boolean;
    function  GetOwnerPassword: string;
    procedure SetOwnerPassword(AValue: string);
    function  GetUserPassword: string;
    procedure SetUserPassword(AValue: string);
    procedure SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
    procedure SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
    procedure SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property NumSignatures: Integer read GetNumSignatures;
    property NumPages: Integer read GetNumPages;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;
    property SigAllocateSize: Integer read GetSigAllocateSize write SetSigAllocateSize;
    property NumEmbeddedFiles: Integer read GetNumEmbeddedFiles;
    property HasCertificationSig: Boolean read GetHasCertificationSig;
    property OwnerPassword: string read GetOwnerPassword write SetOwnerPassword;
    property UserPassword: string read GetUserPassword write SetUserPassword;

    { Event callbacks.  Return True from OnAbortCheck / OnPercentDone
      to abort the running method.  Callbacks are invoked on the
      thread that called the Chilkat method.  The HeartbeatMs
      property controls the AbortCheck frequency. }
    property OnAbortCheck: TChilkatAbortCheckEvent read FOnAbortCheck write SetOnAbortCheck;
    property OnPercentDone: TChilkatPercentDoneEvent read FOnPercentDone write SetOnPercentDone;
    property OnProgressInfo: TChilkatProgressInfoEvent read FOnProgressInfo write SetOnProgressInfo;

    function  LoadFile(const filePath: string): Boolean;
    function  LoadBd(pdfData: TChilkatBase): Boolean;
    function  VerifySignature(index: Integer; sigInfo: TChilkatBase): Boolean;
    function  SignPdf(jsonOptions: TChilkatBase; const outFilePath: string): Boolean;
    function  GetDss(json: TChilkatBase): Boolean;
    procedure SetHttpObj(http: TChilkatBase);
    function  SetSigningCert(cert: TChilkatBase): Boolean;
    function  SetSigningCert2(cert: TChilkatBase; privateKey: TChilkatBase): Boolean;
    function  AddSigningCert(cert: TChilkatBase): Boolean;
    function  SetSignatureJpeg(jpgData: TChilkatBase): Boolean;
    function  GetSignerCert(index: Integer; cert: TChilkatBase): Boolean;
    function  GetUnsignedSigFields(json: TChilkatBase): Boolean;
    function  GetSignatureContent(index: Integer; bd: TChilkatBase): Boolean;
    function  GetMetadata(sb: TChilkatBase): Boolean;
    function  AddVerificationInfo(jsonOptions: TChilkatBase; const outFilePath: string): Boolean;
    function  SignPdfBd(jsonOptions: TChilkatBase; bd: TChilkatBase): Boolean;
    function  GetEmbeddedFileInfo(index: Integer; json: TChilkatBase): Boolean;
    function  GetEmbeddedFileBd(index: Integer; bd: TChilkatBase): Boolean;
    function  AddEmbeddedFiles(json: TChilkatBase; const outFilePath: string): Boolean;
    function  AddEmbeddedFilesBd(json: TChilkatBase; bd: TChilkatBase): Boolean;
    function  UpdateMetadata(sb: TChilkatBase; const outFilePath: string): Boolean;
    function  UpdateMetadataBd(sb: TChilkatBase; bd: TChilkatBase): Boolean;
    procedure GetLastJsonData(json: TChilkatBase);
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkPdf_Create  = function(): Pointer; cdecl;
  TCkPdf_Dispose = procedure(handle: Pointer); cdecl;
  TCkBridgeAbortCheckCb   = function(userData: Pointer): Integer; cdecl;
  TCkBridgePercentDoneCb  = function(pctDone: Integer; userData: Pointer): Integer; cdecl;
  TCkBridgeProgressInfoCb = procedure(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
  TCkPdf_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkPdf_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkPdf_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkPdf_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkPdf_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkPdf_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkPdf_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkPdf_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkPdf_get_NumSignatures = function(handle: Pointer): Integer; cdecl;
  TCkPdf_get_NumPages = function(handle: Pointer): Integer; cdecl;
  TCkPdf_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkPdf_get_SigAllocateSize = function(handle: Pointer): Integer; cdecl;
  TCkPdf_put_SigAllocateSize = procedure(handle: Pointer; value: Integer); cdecl;
  TCkPdf_get_NumEmbeddedFiles = function(handle: Pointer): Integer; cdecl;
  TCkPdf_get_HasCertificationSig = function(handle: Pointer): LongBool; cdecl;
  TCkPdf_get_OwnerPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_put_OwnerPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkPdf_get_UserPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkPdf_put_UserPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkPdf_LoadFile = function(handle: Pointer; filePath: PAnsiChar): LongBool; cdecl;
  TCkPdf_LoadBd = function(handle: Pointer; pdfData: Pointer): LongBool; cdecl;
  TCkPdf_VerifySignature = function(handle: Pointer; index: Integer; sigInfo: Pointer): LongBool; cdecl;
  TCkPdf_SignPdf = function(handle: Pointer; jsonOptions: Pointer; outFilePath: PAnsiChar): LongBool; cdecl;
  TCkPdf_GetDss = function(handle: Pointer; json: Pointer): LongBool; cdecl;
  TCkPdf_SetHttpObj = procedure(handle: Pointer; http: Pointer); cdecl;
  TCkPdf_SetSigningCert = function(handle: Pointer; cert: Pointer): LongBool; cdecl;
  TCkPdf_SetSigningCert2 = function(handle: Pointer; cert: Pointer; privateKey: Pointer): LongBool; cdecl;
  TCkPdf_AddSigningCert = function(handle: Pointer; cert: Pointer): LongBool; cdecl;
  TCkPdf_SetSignatureJpeg = function(handle: Pointer; jpgData: Pointer): LongBool; cdecl;
  TCkPdf_GetSignerCert = function(handle: Pointer; index: Integer; cert: Pointer): LongBool; cdecl;
  TCkPdf_GetUnsignedSigFields = function(handle: Pointer; json: Pointer): LongBool; cdecl;
  TCkPdf_GetSignatureContent = function(handle: Pointer; index: Integer; bd: Pointer): LongBool; cdecl;
  TCkPdf_GetMetadata = function(handle: Pointer; sb: Pointer): LongBool; cdecl;
  TCkPdf_AddVerificationInfo = function(handle: Pointer; jsonOptions: Pointer; outFilePath: PAnsiChar): LongBool; cdecl;
  TCkPdf_SignPdfBd = function(handle: Pointer; jsonOptions: Pointer; bd: Pointer): LongBool; cdecl;
  TCkPdf_GetEmbeddedFileInfo = function(handle: Pointer; index: Integer; json: Pointer): LongBool; cdecl;
  TCkPdf_GetEmbeddedFileBd = function(handle: Pointer; index: Integer; bd: Pointer): LongBool; cdecl;
  TCkPdf_AddEmbeddedFiles = function(handle: Pointer; json: Pointer; outFilePath: PAnsiChar): LongBool; cdecl;
  TCkPdf_AddEmbeddedFilesBd = function(handle: Pointer; json: Pointer; bd: Pointer): LongBool; cdecl;
  TCkPdf_UpdateMetadata = function(handle: Pointer; sb: Pointer; outFilePath: PAnsiChar): LongBool; cdecl;
  TCkPdf_UpdateMetadataBd = function(handle: Pointer; sb: Pointer; bd: Pointer): LongBool; cdecl;
  TCkPdf_GetLastJsonData = procedure(handle: Pointer; json: Pointer); cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkPdf_Create:  TCkPdf_Create  = nil;
  CkPdf_Dispose: TCkPdf_Dispose = nil;
  CkPdf_SetAbortCheckCallback:   TCkPdf_SetAbortCheckCallback   = nil;
  CkPdf_SetPercentDoneCallback:  TCkPdf_SetPercentDoneCallback  = nil;
  CkPdf_SetProgressInfoCallback: TCkPdf_SetProgressInfoCallback = nil;
  CkPdf_get_LastErrorHtml: TCkPdf_get_LastErrorHtml = nil;
  CkPdf_get_LastErrorText: TCkPdf_get_LastErrorText = nil;
  CkPdf_get_LastErrorXml: TCkPdf_get_LastErrorXml = nil;
  CkPdf_get_Version: TCkPdf_get_Version = nil;
  CkPdf_get_DebugLogFilePath: TCkPdf_get_DebugLogFilePath = nil;
  CkPdf_put_DebugLogFilePath: TCkPdf_put_DebugLogFilePath = nil;
  CkPdf_get_VerboseLogging: TCkPdf_get_VerboseLogging = nil;
  CkPdf_put_VerboseLogging: TCkPdf_put_VerboseLogging = nil;
  CkPdf_get_LastMethodSuccess: TCkPdf_get_LastMethodSuccess = nil;
  CkPdf_put_LastMethodSuccess: TCkPdf_put_LastMethodSuccess = nil;
  CkPdf_get_NumSignatures: TCkPdf_get_NumSignatures = nil;
  CkPdf_get_NumPages: TCkPdf_get_NumPages = nil;
  CkPdf_get_UncommonOptions: TCkPdf_get_UncommonOptions = nil;
  CkPdf_put_UncommonOptions: TCkPdf_put_UncommonOptions = nil;
  CkPdf_get_SigAllocateSize: TCkPdf_get_SigAllocateSize = nil;
  CkPdf_put_SigAllocateSize: TCkPdf_put_SigAllocateSize = nil;
  CkPdf_get_NumEmbeddedFiles: TCkPdf_get_NumEmbeddedFiles = nil;
  CkPdf_get_HasCertificationSig: TCkPdf_get_HasCertificationSig = nil;
  CkPdf_get_OwnerPassword: TCkPdf_get_OwnerPassword = nil;
  CkPdf_put_OwnerPassword: TCkPdf_put_OwnerPassword = nil;
  CkPdf_get_UserPassword: TCkPdf_get_UserPassword = nil;
  CkPdf_put_UserPassword: TCkPdf_put_UserPassword = nil;
  CkPdf_LoadFile: TCkPdf_LoadFile = nil;
  CkPdf_LoadBd: TCkPdf_LoadBd = nil;
  CkPdf_VerifySignature: TCkPdf_VerifySignature = nil;
  CkPdf_SignPdf: TCkPdf_SignPdf = nil;
  CkPdf_GetDss: TCkPdf_GetDss = nil;
  CkPdf_SetHttpObj: TCkPdf_SetHttpObj = nil;
  CkPdf_SetSigningCert: TCkPdf_SetSigningCert = nil;
  CkPdf_SetSigningCert2: TCkPdf_SetSigningCert2 = nil;
  CkPdf_AddSigningCert: TCkPdf_AddSigningCert = nil;
  CkPdf_SetSignatureJpeg: TCkPdf_SetSignatureJpeg = nil;
  CkPdf_GetSignerCert: TCkPdf_GetSignerCert = nil;
  CkPdf_GetUnsignedSigFields: TCkPdf_GetUnsignedSigFields = nil;
  CkPdf_GetSignatureContent: TCkPdf_GetSignatureContent = nil;
  CkPdf_GetMetadata: TCkPdf_GetMetadata = nil;
  CkPdf_AddVerificationInfo: TCkPdf_AddVerificationInfo = nil;
  CkPdf_SignPdfBd: TCkPdf_SignPdfBd = nil;
  CkPdf_GetEmbeddedFileInfo: TCkPdf_GetEmbeddedFileInfo = nil;
  CkPdf_GetEmbeddedFileBd: TCkPdf_GetEmbeddedFileBd = nil;
  CkPdf_AddEmbeddedFiles: TCkPdf_AddEmbeddedFiles = nil;
  CkPdf_AddEmbeddedFilesBd: TCkPdf_AddEmbeddedFilesBd = nil;
  CkPdf_UpdateMetadata: TCkPdf_UpdateMetadata = nil;
  CkPdf_UpdateMetadataBd: TCkPdf_UpdateMetadataBd = nil;
  CkPdf_GetLastJsonData: TCkPdf_GetLastJsonData = nil;

constructor TPdf.Create;
begin
  inherited Create;
  FHandle := CkPdf_Create();
end;

destructor TPdf.Destroy;
begin
  if FHandle <> nil then
    CkPdf_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

{ ---- Event callback thunks ---- }
{ Standalone cdecl functions registered with the C bridge.  The bridge
  passes back the userData pointer, which carries the Pascal object
  instance.  A non-zero return value aborts the running method. }

function TPdf_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TPdf;
begin
  Result := 0;
  obj := TPdf(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

function TPdf_PercentDoneThunk(pctDone: Integer; userData: Pointer): Integer; cdecl;
var
  obj: TPdf;
begin
  Result := 0;
  obj := TPdf(userData);
  if Assigned(obj) and Assigned(obj.FOnPercentDone) then
    if obj.FOnPercentDone(obj, pctDone) then Result := 1;
end;

procedure TPdf_ProgressInfoThunk(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
var
  obj: TPdf;
begin
  obj := TPdf(userData);
  if Assigned(obj) and Assigned(obj.FOnProgressInfo) then
    obj.FOnProgressInfo(obj, CkToStr(name), CkToStr(value));
end;

procedure TPdf.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkPdf_SetAbortCheckCallback(FHandle, @TPdf_AbortCheckThunk, Self)
  else
    CkPdf_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TPdf.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkPdf_SetPercentDoneCallback(FHandle, @TPdf_PercentDoneThunk, Self)
  else
    CkPdf_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TPdf.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkPdf_SetProgressInfoCallback(FHandle, @TPdf_ProgressInfoThunk, Self)
  else
    CkPdf_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TPdf.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkPdf_get_LastErrorHtml(FHandle));
end;

function TPdf.GetLastErrorText: string;
begin
  Result := CkToStr(CkPdf_get_LastErrorText(FHandle));
end;

function TPdf.GetLastErrorXml: string;
begin
  Result := CkToStr(CkPdf_get_LastErrorXml(FHandle));
end;

function TPdf.GetVersion: string;
begin
  Result := CkToStr(CkPdf_get_Version(FHandle));
end;

function TPdf.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkPdf_get_DebugLogFilePath(FHandle));
end;

procedure TPdf.SetDebugLogFilePath(AValue: string);
begin
  CkPdf_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TPdf.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkPdf_get_VerboseLogging(FHandle));
end;

procedure TPdf.SetVerboseLogging(AValue: Boolean);
begin
  CkPdf_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TPdf.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkPdf_get_LastMethodSuccess(FHandle));
end;

procedure TPdf.SetLastMethodSuccess(AValue: Boolean);
begin
  CkPdf_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TPdf.GetNumSignatures: Integer;
begin
  Result := CkPdf_get_NumSignatures(FHandle);
end;

function TPdf.GetNumPages: Integer;
begin
  Result := CkPdf_get_NumPages(FHandle);
end;

function TPdf.GetUncommonOptions: string;
begin
  Result := CkToStr(CkPdf_get_UncommonOptions(FHandle));
end;

procedure TPdf.SetUncommonOptions(AValue: string);
begin
  CkPdf_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TPdf.GetSigAllocateSize: Integer;
begin
  Result := CkPdf_get_SigAllocateSize(FHandle);
end;

procedure TPdf.SetSigAllocateSize(AValue: Integer);
begin
  CkPdf_put_SigAllocateSize(FHandle, AValue);
end;

function TPdf.GetNumEmbeddedFiles: Integer;
begin
  Result := CkPdf_get_NumEmbeddedFiles(FHandle);
end;

function TPdf.GetHasCertificationSig: Boolean;
begin
  Result := Boolean(CkPdf_get_HasCertificationSig(FHandle));
end;

function TPdf.GetOwnerPassword: string;
begin
  Result := CkToStr(CkPdf_get_OwnerPassword(FHandle));
end;

procedure TPdf.SetOwnerPassword(AValue: string);
begin
  CkPdf_put_OwnerPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TPdf.GetUserPassword: string;
begin
  Result := CkToStr(CkPdf_get_UserPassword(FHandle));
end;

procedure TPdf.SetUserPassword(AValue: string);
begin
  CkPdf_put_UserPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TPdf.LoadFile(const filePath: string): Boolean;
begin
  Result := Boolean(CkPdf_LoadFile(FHandle, PAnsiChar(StrToCk(filePath))));
end;

function TPdf.LoadBd(pdfData: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_LoadBd(FHandle, pdfData.Handle));
end;

function TPdf.VerifySignature(index: Integer; sigInfo: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_VerifySignature(FHandle, index, sigInfo.Handle));
end;

function TPdf.SignPdf(jsonOptions: TChilkatBase; const outFilePath: string): Boolean;
begin
  Result := Boolean(CkPdf_SignPdf(FHandle, jsonOptions.Handle, PAnsiChar(StrToCk(outFilePath))));
end;

function TPdf.GetDss(json: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetDss(FHandle, json.Handle));
end;

procedure TPdf.SetHttpObj(http: TChilkatBase);
begin
  CkPdf_SetHttpObj(FHandle, http.Handle);
end;

function TPdf.SetSigningCert(cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_SetSigningCert(FHandle, cert.Handle));
end;

function TPdf.SetSigningCert2(cert: TChilkatBase; privateKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_SetSigningCert2(FHandle, cert.Handle, privateKey.Handle));
end;

function TPdf.AddSigningCert(cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_AddSigningCert(FHandle, cert.Handle));
end;

function TPdf.SetSignatureJpeg(jpgData: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_SetSignatureJpeg(FHandle, jpgData.Handle));
end;

function TPdf.GetSignerCert(index: Integer; cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetSignerCert(FHandle, index, cert.Handle));
end;

function TPdf.GetUnsignedSigFields(json: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetUnsignedSigFields(FHandle, json.Handle));
end;

function TPdf.GetSignatureContent(index: Integer; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetSignatureContent(FHandle, index, bd.Handle));
end;

function TPdf.GetMetadata(sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetMetadata(FHandle, sb.Handle));
end;

function TPdf.AddVerificationInfo(jsonOptions: TChilkatBase; const outFilePath: string): Boolean;
begin
  Result := Boolean(CkPdf_AddVerificationInfo(FHandle, jsonOptions.Handle, PAnsiChar(StrToCk(outFilePath))));
end;

function TPdf.SignPdfBd(jsonOptions: TChilkatBase; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_SignPdfBd(FHandle, jsonOptions.Handle, bd.Handle));
end;

function TPdf.GetEmbeddedFileInfo(index: Integer; json: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetEmbeddedFileInfo(FHandle, index, json.Handle));
end;

function TPdf.GetEmbeddedFileBd(index: Integer; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_GetEmbeddedFileBd(FHandle, index, bd.Handle));
end;

function TPdf.AddEmbeddedFiles(json: TChilkatBase; const outFilePath: string): Boolean;
begin
  Result := Boolean(CkPdf_AddEmbeddedFiles(FHandle, json.Handle, PAnsiChar(StrToCk(outFilePath))));
end;

function TPdf.AddEmbeddedFilesBd(json: TChilkatBase; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_AddEmbeddedFilesBd(FHandle, json.Handle, bd.Handle));
end;

function TPdf.UpdateMetadata(sb: TChilkatBase; const outFilePath: string): Boolean;
begin
  Result := Boolean(CkPdf_UpdateMetadata(FHandle, sb.Handle, PAnsiChar(StrToCk(outFilePath))));
end;

function TPdf.UpdateMetadataBd(sb: TChilkatBase; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkPdf_UpdateMetadataBd(FHandle, sb.Handle, bd.Handle));
end;

procedure TPdf.GetLastJsonData(json: TChilkatBase);
begin
  CkPdf_GetLastJsonData(FHandle, json.Handle);
end;

initialization
  Chilkat_GetProcedureAddress(CkPdf_Create,  'CkPdf_Create');
  Chilkat_GetProcedureAddress(CkPdf_Dispose, 'CkPdf_Dispose');
  Chilkat_GetProcedureAddress(CkPdf_SetAbortCheckCallback, 'CkPdf_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkPdf_SetPercentDoneCallback, 'CkPdf_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkPdf_SetProgressInfoCallback, 'CkPdf_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkPdf_get_LastErrorHtml, 'CkPdf_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkPdf_get_LastErrorText, 'CkPdf_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkPdf_get_LastErrorXml, 'CkPdf_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkPdf_get_Version, 'CkPdf_get_Version');
  Chilkat_GetProcedureAddress(CkPdf_get_DebugLogFilePath, 'CkPdf_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkPdf_put_DebugLogFilePath, 'CkPdf_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkPdf_get_VerboseLogging, 'CkPdf_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkPdf_put_VerboseLogging, 'CkPdf_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkPdf_get_LastMethodSuccess, 'CkPdf_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkPdf_put_LastMethodSuccess, 'CkPdf_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkPdf_get_NumSignatures, 'CkPdf_get_NumSignatures');
  Chilkat_GetProcedureAddress(CkPdf_get_NumPages, 'CkPdf_get_NumPages');
  Chilkat_GetProcedureAddress(CkPdf_get_UncommonOptions, 'CkPdf_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkPdf_put_UncommonOptions, 'CkPdf_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkPdf_get_SigAllocateSize, 'CkPdf_get_SigAllocateSize');
  Chilkat_GetProcedureAddress(CkPdf_put_SigAllocateSize, 'CkPdf_put_SigAllocateSize');
  Chilkat_GetProcedureAddress(CkPdf_get_NumEmbeddedFiles, 'CkPdf_get_NumEmbeddedFiles');
  Chilkat_GetProcedureAddress(CkPdf_get_HasCertificationSig, 'CkPdf_get_HasCertificationSig');
  Chilkat_GetProcedureAddress(CkPdf_get_OwnerPassword, 'CkPdf_get_OwnerPassword');
  Chilkat_GetProcedureAddress(CkPdf_put_OwnerPassword, 'CkPdf_put_OwnerPassword');
  Chilkat_GetProcedureAddress(CkPdf_get_UserPassword, 'CkPdf_get_UserPassword');
  Chilkat_GetProcedureAddress(CkPdf_put_UserPassword, 'CkPdf_put_UserPassword');
  Chilkat_GetProcedureAddress(CkPdf_LoadFile, 'CkPdf_LoadFile');
  Chilkat_GetProcedureAddress(CkPdf_LoadBd, 'CkPdf_LoadBd');
  Chilkat_GetProcedureAddress(CkPdf_VerifySignature, 'CkPdf_VerifySignature');
  Chilkat_GetProcedureAddress(CkPdf_SignPdf, 'CkPdf_SignPdf');
  Chilkat_GetProcedureAddress(CkPdf_GetDss, 'CkPdf_GetDss');
  Chilkat_GetProcedureAddress(CkPdf_SetHttpObj, 'CkPdf_SetHttpObj');
  Chilkat_GetProcedureAddress(CkPdf_SetSigningCert, 'CkPdf_SetSigningCert');
  Chilkat_GetProcedureAddress(CkPdf_SetSigningCert2, 'CkPdf_SetSigningCert2');
  Chilkat_GetProcedureAddress(CkPdf_AddSigningCert, 'CkPdf_AddSigningCert');
  Chilkat_GetProcedureAddress(CkPdf_SetSignatureJpeg, 'CkPdf_SetSignatureJpeg');
  Chilkat_GetProcedureAddress(CkPdf_GetSignerCert, 'CkPdf_GetSignerCert');
  Chilkat_GetProcedureAddress(CkPdf_GetUnsignedSigFields, 'CkPdf_GetUnsignedSigFields');
  Chilkat_GetProcedureAddress(CkPdf_GetSignatureContent, 'CkPdf_GetSignatureContent');
  Chilkat_GetProcedureAddress(CkPdf_GetMetadata, 'CkPdf_GetMetadata');
  Chilkat_GetProcedureAddress(CkPdf_AddVerificationInfo, 'CkPdf_AddVerificationInfo');
  Chilkat_GetProcedureAddress(CkPdf_SignPdfBd, 'CkPdf_SignPdfBd');
  Chilkat_GetProcedureAddress(CkPdf_GetEmbeddedFileInfo, 'CkPdf_GetEmbeddedFileInfo');
  Chilkat_GetProcedureAddress(CkPdf_GetEmbeddedFileBd, 'CkPdf_GetEmbeddedFileBd');
  Chilkat_GetProcedureAddress(CkPdf_AddEmbeddedFiles, 'CkPdf_AddEmbeddedFiles');
  Chilkat_GetProcedureAddress(CkPdf_AddEmbeddedFilesBd, 'CkPdf_AddEmbeddedFilesBd');
  Chilkat_GetProcedureAddress(CkPdf_UpdateMetadata, 'CkPdf_UpdateMetadata');
  Chilkat_GetProcedureAddress(CkPdf_UpdateMetadataBd, 'CkPdf_UpdateMetadataBd');
  Chilkat_GetProcedureAddress(CkPdf_GetLastJsonData, 'CkPdf_GetLastJsonData');

end.
