Table of Contents

Getting started with TMS FNC Cloud File Conversion

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • An API key for one of the supported conversion services: CloudConvert (default), Convert.io, or Zamzar.

Add the component

  1. Drop TTMSFNCCloudFileConversion onto a form (or create it in code).
  2. Select the backend with Service and set APIKey.
  3. Call ConvertFile (or ConvertFileFromURL/ConvertFileFromBase64) and handle OnConvertJobFinished.

Minimal example

Set the API key, convert a local file to PDF, and read the result once it finishes:

procedure TForm1.ConvertReportToPDF;
begin
  TMSFNCCloudFileConversion1.OnConvertJobFinished := FileConversionJobFinished;
  TMSFNCCloudFileConversion1.ConvertFile('C:\local\report.docx', fcfPdf);
end;

procedure TForm1.FileConversionJobFinished(Sender: TObject;
  const ARequestResult: TTMSFNCCloudBaseRequestResult;
  AJob: TTMSFNCCloudFileConversionJob; AStatus: TTMSFNCCloudFileConversionJobStatus);
begin
  if AStatus = fcjsSuccessful then
    Memo1.Lines.Add('Converted, ' + IntToStr(AJob.OutputFiles.Count) + ' file(s) ready')
  else
    Memo1.Lines.Add('Conversion did not succeed: ' + TTMSFNCCloudFileConversion.GetStatusText(AStatus));
end;

Next steps