ODF2PDF
Copyright © 2019, 2020 Erick Engelke
ODF2PDF is used to generate form letters as PDF files from Open Document Format (ODF) files you can prepare in Microsoft Word or any number of other Word Processors.
Simply create a word processing document using tables to organize your document layout. Then use a variable like %%address%% to contain variable that ODF2PDF will replace with values from your database application.
NOTE: all variable names must be lower case.
Then call with code like this:
var
eedoc: TEEPDFDocument;
procedure FillParameters(ee: TEEPDFDocument);
begin
ee.replacements.Clear;
ee.replacements.Values['salutation'] := 'Dr';
ee.replacements.Values['firstname'] := 'Thomas';
end;
begin
reportmemoryleaksonshutdown := True;
eedoc := TEEPDFDocument.Create(false, 0, false,
{$IFDEF USE_PDFSECURITY}TPdfEncryption.New(elRC4_40, '', 'toto',
PDF_PERMISSION_NOMODIF){$ENDIF});
try
eedoc.PaperSize := psLetter;
eedoc.LoadFromODT('sample.odt');
FillParameters(eedoc);
eedoc.GeneratePDF;
except
on E: Exception do
writeln(E.message);
end;
eedoc.Free;
end;