A set of tools for exporting data and documents from AbraFlexi (FlexiBee) accounting system, including invoices and their attachments.
- Export all received invoices (
faktura-prijata) as PDF - Download and process all attachments for each invoice
- Extract and merge PDFs from ISDOCX attachments
- Skip ISDOC (XML) attachments automatically
- Merge all PDFs (invoices and attachments) into a single PDF file
- Configurable via
.envfile or command-line options - Supports filtering by year, date, or custom FlexiBee filter using
EXPORT_SCOPE
- PHP 8.0+
- Composer dependencies (see
composer.json) pdfuniteutility (from poppler-utils) for PDF mergingqpdfutility for encrypted PDF detection
-
Configure environment:
- Copy
example.envto.envand fill in your AbraFlexi credentials and company code. - Optionally set
EXPORT_SCOPEto restrict export by year (e.g.2024), date (e.g.2025-06-12), or a custom filter (e.g.datVyst >= '2025-01-01' AND datVyst <= '2025-06-12').
- Copy
-
Install dependencies:
composer install
-
Run the export script:
cd src php export_faktura_prijata_with_attachments.php- Use
-o <output.json>to specify a report file. - Use
-e <envfile>to specify a custom environment file.
- Use
-
Result:
- The merged PDF will be saved as
all-invoices-and-attachments.pdfin the project root. - A JSON report will be saved to the specified output or to stdout.
- The merged PDF will be saved as
- The script fetches all received invoices from AbraFlexi using the API.
- Each invoice is downloaded as a PDF.
- All attachments are downloaded. If an attachment is an ISDOCX file, the script extracts any PDF inside and includes it in the merge. ISDOC files are skipped.
- Encrypted PDFs are detected and skipped using
qpdf. - All unencrypted PDFs are merged into a single file using
pdfunite.
See LICENSE.
Vitex Software info@vitexsoftware.cz
Special thanks to our sponsor, Utopia, for their support and contributions to this project.