Skip to main content

cURL command for generating an invoice as a PDF

How to generate a PDF from your app using the REST API and cURL

Written by Petr Pech

You can export a document's print report from ABRA Flexi as a PDF and save it to a file with a single cURL command.


Command

curl -u uzivatel:heslo -k -L -f \
"https://server:5434/c/{firma}/faktura-vydana/1.pdf" \
-o faktura.pdf

Individual parameters:

Parameter

Meaning

-u

Login credentials for ABRA Flexi in the form jméno:heslo.

-k

Skips certificate verification. Needed only for a self-hosted installation with an automatically generated certificate.

-L

Follows redirects. Always needed when you're not identifying the document by its internal number — the server responds to a code or external identifier with 301 and redirects to the address containing the internal number.

-f

On a server error, writes nothing to the output and exits with a non-zero return code. Without it, you'd end up with a "PDF" that actually contains an error page.

-o

The file the response will be written to.

💡 Without an additional parameter, the default report for the record type is used. You select a specific report using ?report-name= — take the name from the /c/{firma}/{evidence}/reports.xml list, since a nonexistent name will result in a 500 error. For details, see the article Exporting print reports (PDF / XLSX).


Related

Did this answer your question?