You are not logged in.
If I put a custom title in the PDF Info, it works as long as the PDF version is 1.3.
Whenever I use a function that bumps the PDF version to >1.3 (eg. pdf.UseOptionalContent := true;) then the PDF Info is not saved anymore, and the title is lost.
Is this normal?
Offline
Is this normal?
Works fine for me (with latest mORMot 2 sources).
What version of code are you using?
(otherwise a small sample would be helpful)
This works for me (generates a 1.5 PDF):
procedure MakePdfSynPdf;
var
FileTemp: string;
pdf: TPdfDocumentGDI;
begin
FileTemp := 'C:\Temp\Test1.pdf';
pdf := TPdfDocumentGDI.Create;
try
pdf.UseOptionalContent := true;
pdf.Info.Title := 'Title name';
pdf.Info.Author := 'User name';
pdf.Info.Creator := 'Software name';
pdf.Info.subject := 'Auto generated document';
// page 1
{ page := } pdf.AddPage;
pdf.VCLCanvas.Font.Name := 'Times New Roman';
pdf.VCLCanvas.Font.size := 24;
pdf.VCLCanvas.TextOut(100, 100, 'some text on page 1');
// page 2
{ page := } pdf.AddPage;
pdf.VCLCanvas.Font.Name := 'Times New Roman';
pdf.VCLCanvas.Font.size := 24;
pdf.VCLCanvas.TextOut(100, 100, 'some text on page 2');
// back to page 1
pdf.Canvas.SetPage(pdf.RawPages[0]);
pdf.VCLCanvas.Font.Name := 'Times New Roman';
pdf.VCLCanvas.Font.size := 24;
pdf.VCLCanvas.TextOut(200, 200, 'some extra text on page 1');
pdf.SaveToFile(FileTemp);
ExecAssociatedApp(FileTemp);
finally
pdf.Free;
end;
end;
Offline
Thank you very much for your attempt, and thanks to this I found out the problem.
I was using pdf.UseOptionalContent := true; after setting the Info data, and this will not work.
So the correct way to use it is setting the UseOptionalContent to true as first thing, then setting the Info data.
This is indeed documented in the code, so it was an overlook on my part, my mistake.
Thank you again.
Offline