Skip to content

sstybel/ksef-pdf-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KSeF PDF Generator

Static Badge GitHub Release GitHub Downloads (all assets, all releases)

A tool for generating visualizations of invoices in PDF format based on XML invoice files downloaded from the National e-Invoice System (KSeF - Krajowy System e-Faktur) - https://ksef.podatki.gov.pl/.

The repository of this tool is based on a fork originating from:

  1. https://github.com/CIRFMF/ksef-pdf-generator (@CIRF)
  2. https://github.com/aiv/ksef-pdf-generator (@aiv (Mariusz Dalewski)

This application only creates visualizations of KSeF invoices in XML format downloaded from the National e-Invoice System (e.g., using the tool KSeF XML Downloader). The generated invoices contain a QR code that can be used to check whether your invoice is in the KSeF system.

Starting with version 1.1.0 releases, it is now possible to convert KSeF XML invoices to PDF files based on the status of downloaded KSeF XML invoices using the KSeF XML Downloader tool . The KSeF XML Downloader tool saves the result of its operation, among other things, to a JSON file, which contains, among other things, the location of invoices in KSeF XML format. This file (JSON) can now be used as a source to indicate the location of KSeF XML invoice files.

Example Screen-Shot

 

Example Screen-Shot

Click to see a sample PDF invoice generated based on the KSeF XML file.

Syntax of the ksef-pdf-generator.exe

Usage: ksef-pdf-generator.exe <ksef-xml-file> [options]

Options:

  • [-s], [-state] [X:\path\output-json.json] - Convert KSeF XML invoices to PDFs based on the state of the downloaded KSeF XML invoices by the tool KSeF XML Downloader
  • [-o], [--output] [<ksef-pdf-file>] - Path to the output PDF file (default: XML file name changed to .pdf)
  • -h, --help - Display this help message

Notes:

  • The KSeF number is automatically detected from the XML file name. Format: <nip>-<date>-<hash>-<codec_crc>.xml (e.g., 0101010101-20260201-1A2B3C456D7E-F8.xml)
  • If the KSeF number is not found, the value “NONE” is used.
  • The QR code is generated based on the KSeF number. If the KSeF number is not found, the KSeF value will be used as “NONE” and the QR code will use 0101010101-20260201-1A2B3C456D7E-F8 (KSeF number) as the default value for generating the QR code.
  • If you use the KSeF XML Downloader to generate invoices based on the status of downloaded invoices, the PDF invoice visualizations will be saved in the same location as the KSeF XML invoice files. The invoice name will be the same as the KSeF XML invoice file, with the extension changed from XML to PDF.

Examples


ksef-pdf-generator.exe 0101010101-20260201-1A2B3C456D7E-F8.xml


Output file: .\0101010101-20260201-1A2B3C456D7E-F8.pdf

 

ksef-pdf-generator.exe .\assets\invoice.xml -o output.pdf


Output file: .\output.pdf

 

ksef-pdf-generator.exe -s d:\\_ksef_\\ksef_invoices-output-json_20260217112540.json


Output file(s):

d:\\_ksef_\\0101010101-20260201-1A2B3C456D7A-F8.pdf d:\\_ksef_\\2020202020-20260202-1A2B3C456D7B-C9.pdf

...

d:\\_ksef_\\1919191919-20260209-1A2B3C456D7C-5A.pdf

   

Example Screen-Shot

 

Example Screen-Shot

Click to see a sample PDF invoice generated based on the KSeF XML file.

Download

Static Badge GitHub Release GitHub Downloads (all assets, all releases)

GitHub

GitHub stats

 


Copyright © 2025 - 2026 by Sebastian Stybel, www.BONO-IT.pl

About

KSeF PDF Generator - A tool for generating PDF documents from KSeF XML files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published