var
globalSettings : Pointer;
objectSettings : Pointer;
pdfConverter : Pointer;
begin
if wkhtmltopdf_init(0) <> 0 then begin
globalSettings := wkhtmltopdf_create_global_settings();
wkhtmltopdf_set_global_setting(globalSettings, PChar('out'), PChar('test.pdf'));
wkhtmltopdf_set_global_setting(globalSettings, PChar('size.PageSize'), PChar('A4'));
wkhtmltopdf_set_global_setting(globalSettings, PChar('orientation'), PChar('Landscape'));
objectSettings := wkhtmltopdf_create_object_settings();
wkhtmltopdf_set_object_setting(objectSettings, PChar('page'), PChar('rpt.html'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('load.blockLocalFileAccess'), PChar('false'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('header.fontSize'), PChar('10'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('header.fontName'), PChar('Arial'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('header.right'), PChar('Header Right'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('header.line'), PChar('true'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('header.spacing'), PChar('5'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.fontSize'), PChar('10'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.fontName'), PChar('Arial'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.left'), PChar('test-left'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.right'), PChar('[page] / [topage]'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.line'), PChar('true'));
wkhtmltopdf_set_object_setting(objectSettings, PChar('footer.spacing'), PChar('5'));
pdfConverter := wkhtmltopdf_create_converter(globalSettings);
wkhtmltopdf_add_object(pdfConverter, objectSettings, nil); //<------------ Problem
if wkhtmltopdf_convert(pdfConverter) = 0 then begin //<------------ Exception
MessageDlg('PDF', 'Conversion Failed', mtInformation, [mbOK], 0);
end;
wkhtmltopdf_destroy_converter(pdfConverter);
wkhtmltopdf_deinit();
end
else begin;
MessageDlg('PDF', 'Init Failed', mtInformation, [mbOK], 0);
end;
end;