function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew BirckbichlerMatthew Birckbichler 

Utilize Command Line Tools Within Apex?

I downloaded a command-line toolkit to my desktop to that has the capability to edit pdfs, which is something I need to do within salesforce. I was thinking that I either need to set up a server (which I know nothing about), or utilize the local machine command line somehow. Any thoughts on this? or am I on the wrong path?
Best Answer chosen by Matthew Birckbichler
James LoghryJames Loghry
Matthew,

You cannot run command line tools in Apex itself.  What you could do however, is see if you can run it on a service like Heroku, and then expose it as an API that Salefsorce could call.  Otherwise, if you're editing PDFs, look for a javascript PDF library such as https://parall.ax/products/jspdf, that you could potentially use in a Visualforce solution.  Otherwise, you could also try utilizing your own custom solution using the getContentAsPDF method / renderAs="pdf" in Visualforce

All Answers

James LoghryJames Loghry
Matthew,

You cannot run command line tools in Apex itself.  What you could do however, is see if you can run it on a service like Heroku, and then expose it as an API that Salefsorce could call.  Otherwise, if you're editing PDFs, look for a javascript PDF library such as https://parall.ax/products/jspdf, that you could potentially use in a Visualforce solution.  Otherwise, you could also try utilizing your own custom solution using the getContentAsPDF method / renderAs="pdf" in Visualforce
This was selected as the best answer
Matthew BirckbichlerMatthew Birckbichler
Thanks for the quick response James, the toolkit I am using simply came with a setup.exe and I've tested that it works through the command line on my machine.  I've never used anything like heroku, does this sound like something that will work?