Search Results for

    Show / Hide Table of Contents

    Exporting a report to PDF

    This article walks you through the process of exporting a report with the FastReport Cloud report processor.

    Getting Started

    You will need the following tools and features:

    1. Knowledge of using API key in FastReport Cloud. You can find how to get and use an API key in the article Authentication and authorization

      This article will skip additional information on authentication and authorization.

    2. Curl tool.

      Any other REST client will do, but the examples will be built for curl.

    3. Report.

      You can find how to build a report in the article Building a report.

    4. Active FastReport Cloud subscription.

    5. Access to the Internet.

    Comment

    Please note that the report can be exported directly from the template, without intermediate saving of the report. To do this, run the same commands for the report template, replacing Report in the request strings with Template, also use the template identifier, not that of the report.

    Instruction

    1. You will need a report identifier to export to PDF. Make a GET request to https://fastreport.cloud/api/rp/v1/Report/Root to get the root directory.

      Request example.

      curl -X GET "https://fastreport.cloud/api/rp/v1/Reports/Root" -H "accept: text/plain"
      

      Response example.

      {
        "name": "RootFolder",
        "parentId": null,
        "tags": null,
        "icon": null,
        "type": "Folder",
        "size": 16384,
        "subscriptionId": "5fa919fa292a8300019349bc",
        "status": "None",
        "id": "5fa919f9292a8300019349ba",
        "createdTime": "2020-11-09T10:29:13.993Z",
        "creatorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491",
        "editedTime": "0001-01-01T00:00:00Z",
        "editorUserId": null
      }
      

      The directory identifier from the example above is 5fa919f9292a8300019349ba.

      1. Get a list of files in the directory, to do this, make a GET request to https://fastreport.cloud/api/rp/v1/Reports/Folder/{id}/ListFiles?skip=0&take=10, where {id} should be replaced with a directory identifier.

      Request example.

      curl -X GET "https://fastreport.cloud/api/rp/v1/Reports/Folder/5fa919f9292a8300019349ba/ListFiles?skip=0&take=10" -H "accept: text/plain"
      

      Response example.

      [
        {
          "templateId": "5fc9ece6b792c90001d94b13",
          "reportInfo": null,
          "name": "awesome_report.fpx",
          "parentId": "5fa919f9292a8300019349ba",
          "tags": null,
          "icon": null,
          "type": "File",
          "size": 16927,
          "subscriptionId": "5fa919fa292a8300019349bc",
          "status": "Success",
          "id": "5fe4614bcd7c55000148e4c6",
          "createdTime": "2020-12-24T09:37:15.716Z",
          "creatorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491",
          "editedTime": "2020-12-24T09:37:15.716Z",
          "editorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491"
        }
      ]
      

      The report identifier from the example above is 5fe4614bcd7c55000148e4c6.

    2. To export a report, a directory will be needed to put the export file to.

      Get the exports root directory by making a GET request to https://fastreport.cloud/api/rp/v1/Exports/Root.

      Request example.

      curl -X GET "https://fastreport.cloud/api/rp/v1/Exports/Root" -H "accept: text/plain"
      

      Response example.

      {
        "name": "RootFolder",
        "parentId": null,
        "tags": null,
        "icon": null,
        "type": "Folder",
        "size": 16384,
        "subscriptionId": "5fa919fa292a8300019349bc",
        "status": "None",
        "id": "5fa919fa292a8300019349bb",
        "createdTime": "2020-11-09T10:29:14.002Z",
        "creatorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491",
        "editedTime": "0001-01-01T00:00:00Z",
        "editorUserId": null
      }
      

      The directory identifier from the example above is 5fa919fa292a8300019349bb.

    3. To export a report, make a POST request to https://fastreport.cloud/api/rp/v1/Reports/File/{id}/Export, where {id} should be replaced with the report identifier.

      In the request body, pass the JSON as shown below.

      {
        "fileName": "awesome_result.pdf",
        "folderId": "5fa919fa292a8300019349bb",
        "locale": "en-GB",
        "format": "Pdf",
        "exportParameters": {
          "additionalProp1": {},
          "additionalProp2": {},
          "additionalProp3": {}
        }
      }
      
      • folderId — identifier of the directory where the export will be placed. If left blank, the export will be placed in the exports root folder in the workspace.
      • fileName — the name of the resulting file. If you do not specify the extension or specify it incorrectly, the server will replace it automatically.
      • locale — localization of the exported report. This option will change the date and number formats to match the selected ISO culture code (for example, French (Switzerland) looks like this—"fr-CH"). Leaving this field blank or specifying a culture that does not exist will substitute the default locale from the subscription or English (United States) if no default locale is specified.
      • format — export format.
      • exportParameters — export parameters. They are set similarly to the export parameters from the FastReport .NET library. A more detailed description is available in the User Manual in the section export parameters.

      If you do not specify folderId, then the prepared report will be saved to the root folder.

      Request example.

      curl -X POST "https://fastreport.cloud/api/rp/v1/Reports/File/5fe4614bcd7c55000148e4c6/Export" -H "accept: text/plain" -H "Content-Type: application/json-patch+json" -d "{ \"fileName\": \"awesome_result.pdf\", \"folderId\": \"5fa919fa292a8300019349bb\", \"locale\":\"ru-RU\", \"format\": \"Pdf\"}"
      

      Response example.

      {
        "format": "Pdf",
        "reportId": "5fe4614bcd7c55000148e4c6",
        "name": "awesome_result.pdf",
        "parentId": "5fa919fa292a8300019349bb",
        "tags": null,
        "icon": null,
        "type": "File",
        "size": 16384,
        "subscriptionId": "5fa919fa292a8300019349bc",
        "status": "InQueue",
        "id": "5fe46a33cd7c55000148e4c7",
        "createdTime": "2020-12-24T10:15:15.8039648+00:00",
        "creatorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491",
        "editedTime": "2020-12-24T10:15:15.8039697+00:00",
        "editorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491"
      }
      

      Note the status of the InQueue file, it means that an export task was created and it has been placed in the builder queue. At this stage the file already received its 5fe46a33cd7c55000148e4c7 identifier for work.

      You should wait some time until the export is built.

    4. To get information about the file, make a GET request to https://fastreport.cloud/api/rp/v1/Exports/File/{id}, where {id} should be replaced with the export identifier.

      Request example.

      curl -X GET "https://fastreport.cloud/api/rp/v1/Exports/File/5fe46a33cd7c55000148e4c7" -H "accept: text/plain"
      

      Response example.

      {
        "format": "Pdf",
        "reportId": "5fe4614bcd7c55000148e4c6",
        "name": "awesome_result.pdf",
        "parentId": "5fa919fa292a8300019349bb",
        "tags": null,
        "icon": null,
        "type": "File",
        "size": 41142,
        "subscriptionId": "5fa919fa292a8300019349bc",
        "status": "Success",
        "id": "5fe46a33cd7c55000148e4c7",
        "createdTime": "2020-12-24T10:15:15.803Z",
        "creatorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491",
        "editedTime": "2020-12-24T10:15:15.803Z",
        "editorUserId": "5af5a8dc-8cb0-40f9-ac99-ca2533fa4491"
      }
      

      Note the Success status of the file. The report has been successfully exported.

    5. To download the report, make a GET request to https://fastreport.cloud/download/e/{id}, where instead of {id}you should pass the report identifier.

      Request example.

      curl -X GET "https://fastreport.cloud/download/e/5fe46a33cd7c55000148e4c7" -H "accept: text/plain"
      

      The file will be in the response.

    What's next?

    • Working with groups.
    • Adding new users to a workspace.
    Back to top © 1998-2025 Copyright Fast Reports Inc.