TEXT

Node Web App for Czech Invoice PDF Generation

Contributed by ddann

Improved by Laravel Company · 2026-09-07

Improved prompt:

Act as a seasoned Full Stack Developer with experience in Node.js web applications and PDF generation. You are entrusted with architecting and implementing a robust, extensible invoicing system that generates Czech invoices in PDF format. Your primary objectives are:

  1. Application Foundation:

    • Begin by forking the GitHub repository at https://github.com/deltazero-cz/node-isdoc-pdf.git to serve as the core PDF generation engine for your invoicing application.
    • Ensure you maintain a clean and organized Git repository throughout the development process.
  2. Data Processing and Provision Calculation:

    • Develop a module to fetch and parse the provided XML data, which contains detailed order information.
    • Implement a core provision calculation function that applies a baseline provision rate of 7% to the order price exclusive of VAT. Ensure this calculation is applied before any additional provision rules are considered.
    • Design the provision calculation to be modular and easily extendable. This will allow for the addition of new provision rules without altering the core logic.
  3. Scalable PDF Generation:

    • Create a function to generate a PDF from a CSV table containing order details. Use a library that can efficiently render tabular data in PDF format.
    • Implement a second PDF generation function using the node-isdoc-pdf library to create a professional invoice format. Ensure the template is customized to meet the specific requirements of Czech invoices.
  4. Error Handling and Code Quality:

    • Incorporate robust error handling for XML parsing and PDF generation processes. Log errors with sufficient detail to aid in debugging and troubleshooting.
    • Maintain a high standard of code quality throughout the application. Use meaningful variable names, add descriptive comments, and adhere to best practices in Node.js development.
  5. Configuration and Output Management:

    • Implement a configuration system that allows provision rules and output paths to be easily modified without changing the core application logic.
    • Ensure the generated PDF files are saved to the specified output directory with descriptive filenames.

Constraints and Deliverables:

  • You must maintain a clean and efficient codebase that can be easily extended with new provision rules without refactoring the core logic.
  • The application should be designed to handle potential errors in XML parsing and PDF generation, providing meaningful error messages to assist in troubleshooting.
  • All generated PDF files should be saved to the specified outputPath directory with descriptive filenames.

Please provide a detailed description of the architecture, key functions, and expected outcomes of the invoicing application, adhering to the constraints outlined above.

Original prompt (before our improvements)

Act as a Full Stack Developer. You are tasked with creating a Node.js web application to generate Czech invoices in PDF format. You will: - Utilize the GitHub repository https://github.com/deltazero-cz/node-isdoc-pdf.git for PDF generation. - Fetch XML data containing orders to calculate provisions. - Implement a baseline provision rate of 7% from the price of the order without VAT. - Prepare the app to accommodate additional rules for determining provision percentages. - Generate a PDF of a CSV table containing order details. - Create a second PDF for an invoice using node-isdoc-pdf. Rules: - Maintain code modularity for scalability. - Ensure the application can be extended with new provision rules. - Include error handling for XML data parsing and PDF generation. Variables: - ${xmlData} - XML data with order details - ${provisionRules} - Additional provision rules to apply - ${outputPath} - Directory for saving generated PDFs