[Solved] Creating PDF with metadata (different thread) lazarus / 21-General ---------------------------------------------------------------------- madref · 2025-02-02 12:02 I am trying to use the metadata for my PDF file I found this thread about it and I am trying to implement this but with no success. This is the code I am using: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses lr_e_fclpdf,      referee_funkties, referee_lint, referee_meldingen, referee_types,     referee_wedstrijd_overzicht; {$R *.lfm} { TForm_Declaratie_Keuze }procedure TForm_Declaratie_Keuze.Declaratie_Afdrukken;var cSQL: string;    Keuze : Integer;begin  // open het rapport in LazReport  Form_Lint.frReport_Evaluatie.ReportAutor := 'Referee';             // does not work  Form_Lint.frReport_Evaluatie.ReportVersionBuild := '5.0';         // does not work  Form_Lint.frReport_Evaluatie.ReportVersionRelease := '5.1';     // does not work   // Load the report  Form_Lint.frReport_Evaluatie.LoadFromFile(RapportDir + 'rpt_Declaratie_Leeg.lrf');   Form_Lint.frReport_Evaluatie.Title := 'Empty Declaration Form for Referee Database Blind Zebras';  Form_Lint.frReport_Evaluatie.ReportAutor:= 'Referee';  Form_Lint.frReport_Evaluatie.ExportTo(TlrPdfExportFilter, UserDir + 'Declaration Blind Zebras.pdf');end;     // Declaratie_Afdrukken  When I execute this code it creates the PDF but with the wrong metadata. What am I doing wrong? See attachment for details ---------------------------------------------------------------------- paweld · 2025-02-02 12:38 As I wrote in that thread you need to apply the patch - you can also download the current the trunk version, as the patch has already been included. The following code behaves correctly for me - see attachment: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.bpdfexportClick(Sender: TObject);begin  raport.LoadFromFile('fv.lrf');  raport.ReportAutor := '-= ' + raport.ReportAutor + ' =-';  raport.Title := '-= ' + raport.Title + ' =-';  if raport.PrepareReport then  begin    raport.ExportTo(TlrPdfExportFilter, 'raport.pdf');    if chbao.Checked then      OpenDocument('raport.pdf');  end;end; ---------------------------------------------------------------------- madref · 2025-02-02 14:50 I did as you suggested and it seems to work but I get a strange behavior (see attachment). The left part of the picture is when I get the info from my viewer and the right part is the info in Finder (MacOs)... I am at a lost..... p.s. is it also possible to change the last 2 entries (there where 'test' is standing)? ---------------------------------------------------------------------- paweld · 2025-02-03 11:58 To the Producer and ApplicationName fields is set the name of the application, so when you change the name of the application to be OK. As for the Author field, I think it's a problem with Finder - it get value from incorrect fiel. ---------------------------------------------------------------------- madref · 2025-02-03 16:45 ok thanks for the answer. But where can I find the name of the application. Because where ever I look I can't find any reference to 'Test' ---------------------------------------------------------------------- paweld · 2025-02-04 06:43 By default, the application title (Producer field) and application name (ApplicationName field) are taken from the aisle name of the executable file without extension. But you can use code to set individual names for these two fields:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  Application.Title := 'My report app title';  //for producer fieldend; function GetMyAppName: String;begin  Result := 'My report app';end; initialization  OnGetApplicationName := @GetMyAppName;  //for applicationname field end. ---------------------------------------------------------------------- madref · 2025-02-04 10:13 Thanks Paveld