I already have a bunch of attachment records that have pdf attached to them.
so what I need to do is to be able to show a table (which I can do) and allow the user to print them in a batch.
I.e. from the table they should be able to select all, or just of few of the records and hit the PRINT] button and the code should print the selected pdf of the records selected.
Has anybody have sample code for sending pdfs to the printer from within skuid?
Thanks in advance.
Hi SDG,
To let users select specific records, I would recommend setting up a mass action on the table that uses the action “Remove row(s) from Model.” This would take the selected rows out of the page’s model - it wouldn’t delete them, but they’d be removed from the current table.
My first thought would be to make use of filters on the table to allow users to build their desired list. There isn’t an action in Skuid’s action framework for printing, but, you could easily add a snippet and run that as part of an action sequence. The simple Javascript code print() will open the browser’s print dialog. The real trick will be to style your Skuid page in a way that will be printer-friendly, using themes or custom CSS.
Thanks for the reply Mark!
I already have the pdfs generated in the Attachment object. All I need is a mechanism to send them to the printer. Preferably without any user intervention.
What I was envisioning was a table that showed a list of Attachment Records with a checkbox fro selecting the records to be printed and some other info relating to the attachement. There will be a button on the page that prints selected pdfs.
When the user clicks on the button, some code will run to send all of the pre-generated PDFS to the printer. Sending the pdfs to the printer code (without user intervention) is what I am missing.
Thanks.
I see what you’re after. Skuid doesn’t have a declarative way to do this, so it sounds like you would need to dig further into custom scripting, and find out if it’s possible to spool documents to the printer via Javascript.
This post reviews a way to do it in APEX. You could probably convert this to invocable apex and pass in the ID’s from Skuid. With mass update you could probably “adopt rows” into a twin model. That would allow you to have just the selected rows in a model. Then you could collect the ID’s from that twin model and pass them as an invocable variable to your invocable Apex. Cloud based PDF merge solution for Force.com | Salesforce Developers Blog
Thanks Raymond,
Very cool solution for generating PDFs, which I may try later, however I already have the PDF code generation done.
I need to be able to send them to the printer without user intervention. Any thoughts on that.
Thanks again.
You may be able to write a javascript snippet that loops through the records in the “twin” model I discuss above and then do something like this: Print PDF directly from JavaScript - Stack Overflow
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.