Dan Rosenstein Posted January 29, 2016 Posted January 29, 2016 (edited) I had a request to print PDFs from an iPad. In the past I created a bot that based on Sic Fried Rice's (if I'm not mistaken) technique would print a label on a label printer by triggering a script from the iPad. I would like to be able print without setting up a Bot, PHP or using a plugin. I got close but for some reason I'm stuck on the last bit and I'm sure other developers have done this before. So the process I came up with so far is: 1, I found a lightweight utility called SumatraPDF which I copied to the Doc folder on the Windows FM 14 server 2. I populated a global field with the batch file string to print the document (e.g. "C:\Program Files\FileMaker\FileMaker Server\Data\Documents\sumatrapdf" "C:\Program Files\FileMaker\FileMaker Server\Data\Documents\1.pdf" -print-to-default) 3. I created a print script for the iPad that runs a PSOS script that exports the global field to the documents folder and opens it So when running the script from the iPad I can see it creates the correct batch file on the server and I can click on it manually to run - it works Problem is it doesn't print when run from the iPad. Maybe 'open automatically' isn't supported on PSOS? I'm open to other ideas.... Dan Update: seems that it is unrelated to printing - the batch file just doesn't get run. Edited January 29, 2016 by Dan Rosenstein
bcooney Posted January 29, 2016 Posted January 29, 2016 Why are you not using the native Save As PDF ( open automatically ) script step?
Dan Rosenstein Posted January 29, 2016 Author Posted January 29, 2016 Well, the issue isn't creating the PDF, it's printing it. In any case, Save As PDF isn't server compatible.
Charles Delfs Posted January 29, 2016 Posted January 29, 2016 I think the challenge here is finding a print server that can run as a service and recalled from FMS SumatraPDF can be hacked to run as a service as seen here ... https://github.com/sumatrapdfreader/sumatrapdf/issues/407
bcooney Posted January 29, 2016 Posted January 29, 2016 You have an existing PDF stored in a container and you need to print it? And you can't export it to temp and open in Preview to print?
Charles Delfs Posted January 29, 2016 Posted January 29, 2016 The PDF needs to be printed at a printer connected to the Server. The PDF is already in the system (FMS). The challenge here is calling a shell command to print, not the PDF itself i think.
Dan Rosenstein Posted January 29, 2016 Author Posted January 29, 2016 That is correct. I got the PDF in a container and out to the server. I can't get the server to run a batch file remotely (triggered by the iPad).
bcooney Posted January 30, 2016 Posted January 30, 2016 Can you flag the record and run a scheduled server script?
Dan Rosenstein Posted January 30, 2016 Author Posted January 30, 2016 Possibly, but the printout needs to be immediate and I would need to schedule it to run every minute (or whatever the fastest occurrence would be) and that could strain the server and the result wouldn't be immediate in most cases.
Charles Delfs Posted February 1, 2016 Posted February 1, 2016 Dan, Give this a try, it will allow OS commands to be executed on a server programatically. http://www.delfsengineering.ca/blog/2016/1/31/run-commands-on-server-from-a-script C.
Dan Rosenstein Posted February 1, 2016 Author Posted February 1, 2016 Great Charles! Seems to work with simple commands (like Dir,Del etc..). Trying to get the print to work too - currently it's stuck on 'transferring url...' and doesn't print. I like the PHP implementation, although it does require the PHP engine to be running. In any case, I think it can be useful for many developers.
OlgerDiekstra Posted February 2, 2016 Posted February 2, 2016 This http://www.biopdf.com/guide/examples/command_line/ might also be of help.
Dan Rosenstein Posted February 4, 2016 Author Posted February 4, 2016 So having done some more testing and investigation I'm close to conclude that the reason the printing isn't working is due to permissions issues on shared network drivers. A preliminary test to a generic local TXT printer seemed to work. Next I will attempt to configure a network printer as a local printer (using the IP as the port) and see if it bites.
Dan Rosenstein Posted February 7, 2016 Author Posted February 7, 2016 Update: I have confirmed that setting up a direct IP port resolves the issue of not being able to print to shared network printers
Recommended Posts
This topic is 3479 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now