Skip to main content

cURL Command for Generating an Invoice to PDF

How to Generate a PDF from an Application Using REST API and cURL

Written by Petr Pech

Example:

curl -u admin:password -k -L -f https://localhost:5434/c/company/faktura-vydana/1.pdf -o file.pdf

  • -u specifies the authorization credentials for Flexi.

  • -L follows redirects. If the URL structure changes in the future, this flag ensures the script will continue to work.

  • -o ensures that the returned data will be written to the file "file.pdf".

  • -f specifies that if a server-side error occurs, nothing should be written to the output — the command should exit immediately instead.

  • -k if you are using a self-hosted installation with an auto-generated certificate, you need to ignore the untrusted certificate authority.

  • -T the file being sent (request body)

cURL has its own documentation.

Did this answer your question?