Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

I've reviewed and tried several UI approaches to give user PDF with data, their overview below. Basically, there are two of them - option 1 and 2 tries give user pdf with what he sees on the screen and option 3 works similar way we expect back-end should - generate pdf from HTML template. To me it looks like the second approach with generating PDF from HTML template with placeholders looks preferable, since it gives you control on info you're going to put there and how it looks. It's not coupled to the UI code, so feature should be more stable between releases. On the other hand, first approach coupled too much to UI code and requires a lot of changes and support of all components used to display required data, it might cause issues in supporting that solution.

Regarding tie time consumption I would say it shouldn't make difference which approach to use.

JIRAs

  • Jira Legacy
    serverSystem JiraJIRA
    serverId01505d01-b853-3c2e-90f1-ee9b165564fc
    keyUIOR-667
  • Jira Legacy
    serverSystem JiraJIRA
    serverId01505d01-b853-3c2e-90f1-ee9b165564fc
    keyUXPROD-2893

...

Approach: html2canvas is  used to capture rendered page into an image, that later can be saved as pdf by jsPDF lib.

Pros:

  • user gets PDF directly, without

Cons:

  • since we can't use media print css queries it requires to re-implement required component on the page with styling appropriate for printing;
  • svg elements are skipped;

...

Option 3 (recommended)

existing approach from ui-requests (UIREQ-382), ui-checkin (UICHKIN-66) - using html-to-react and react-to-print libs.  User goes to Order details pane, clicks Print Order button under order's actions menu.

...