TTMSFMXPDFLib

Metadata (Author, Creator, Title etc.) does not appear to be written to the PDF file. Below is a fragment from my code.

 s := TTMSFMXPDFLib.Create;
  with SaveDialog1 do
  begin
    Filter := 'PDF files (*.pdf)|*.pdf';
    DefaultExt := 'pdf';
    if Execute then
      try
        s.BeginDocument(Filename);
        s.PageSize := psCustom;
        s.PageWidth := SDIAppForm.Chart1.Width;
        s.PageHeight := SDIAppForm.Chart1.Height;
        s.Header := '';
        s.Footer := '';
        s.HeaderSize := 0;
        s.FooterSize := 0;
        s.NewPage;
        s.Graphics.DrawImage(Offscreenbitmap, claBlack, MyRect, True, True,
          itPNG, 1.0);
        s.Author := 'Riskfiniti';
        s.Creator := 'XXX software';
        s.Title := 'Risk Graph or Risk Matrix';
        s.Subject := 'Designed using XXX';
        s.EndDocument(False);
      finally
        s.Free;
        Offscreenbitmap.Free;
      end;
  end;


Hi, 


The meta-data are added to the document before the document is started, please change the code to:


 s := TTMSFMXPDFLib.Create;
  with SaveDialog1 do
  begin
    Filter := 'PDF files (*.pdf)|*.pdf';
    DefaultExt := 'pdf';
    if Execute then
      try
        s.Author := 'Riskfiniti';
        s.Creator := 'XXX software';
        s.Title := 'Risk Graph or Risk Matrix';
        s.Subject := 'Designed using XXX';
        s.BeginDocument(Filename);
        s.PageSize := psCustom;
        s.PageWidth := SDIAppForm.Chart1.Width;
        s.PageHeight := SDIAppForm.Chart1.Height;
        s.Header := '';
        s.Footer := '';
        s.HeaderSize := 0;
        s.FooterSize := 0;
        s.NewPage;
        s.Graphics.DrawImage(Offscreenbitmap, claBlack, MyRect, True, True,
          itPNG, 1.0);
        s.EndDocument(False);
      finally
        s.Free;
        Offscreenbitmap.Free;
      end;
  end;


Thank you! That solved the problem.