4

I need to create a printable view (or PDF) of a record's Lightning Page (think "tear sheet") that includes a compact "details" section, compact related list tables, and a custom LWC chart component. The OOTB solutions don't seem to solve for this well, but I would prefer not to reinvent the wheel and build a printable view from scratch that needs to maintained in parallel with changes to the layout / record page.

OOTB print options: pros & cons

  1. Lightning's Printable View button. Pros: (A) prints record details in a compact fashion, (B) easy to maintain. Cons: (A) prints related list records in a very space-inefficient way, (B) prints just the details and related lists, and so won't include custom Lightning components that exist on the Lightning record page.
  2. Browser's native print function. Pros: (A) prints all items rendered on the Lightning record page (including custom components), (B) easy to maintain. Cons: (A) prints only what's rendered in the browser, and so won't capture content from hidden tabs, e.g. related lists, (B) is space inefficient and comes with funky style quirks.

Custom print page: pros & cons

Pros: control over getting it to look good (compact and quirk-free) Cons: cost to build & maintain

Questions

  1. Am I missing anything with respect to OOTB print functionality?
  2. Is there a relatively low-effort way to "mix & match" the 2 OOTB functionalities ("Printable View" and browser Ctrl+P) to get the compact but comprehensive printable view I'm looking for? I know in VF there were things like <apex:page renderAs="pdf">, <apex:details> and <apex:relatedList> e.g., that could help toward this end. Not aware of anything similar in Lightning.

Update: I started going down the simple VF page route using the components mentioned above, along with <analytics:reportChart>, but unfortunately this analytics VF component uses Lightning Out, and so I can't use Lightning Out for a 2nd app to host my custom LWC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.