Skip to content

fix: PDF download crashes during quote/invoice creation #61

Description

@darshgupta-wisdm

Bug

Clicking the PDF download button while creating a new quote or invoice crashes because html2canvas tries to render a ref that doesn't have valid document data yet.

On edit pages, the html2canvas approach is also unreliable — the server-side PDF API (/api/pdf/quote/{id}) already exists and produces better results.

Fix

  1. New quote/invoice pages: Disable download buttons with "Available after saving" tooltip
  2. Edit pages: Use server-side PDF API instead of html2canvas
  3. Remove ~500 lines of dead html2canvas/jsPDF code (hidden A4 render divs, imports, state)

Files affected

  • apps/web/app/(dashboard)/invoices/new/new-invoice-form.tsx
  • apps/web/app/(dashboard)/quotes/[id]/edit/edit-quote-form.tsx
  • apps/web/app/(dashboard)/quotes/new/new-quote-form.tsx

Port of orekoapp/oreko-pro#11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions