Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Applescript to print to pdf

Featured Replies

Okay, I'm a TOTAL Applescript virgin ... be gentle.

I have a client who wants to be able to switch between printing to her default printer, and printing to a pdf. The print dialog is disabled in all of her print scripts

On the PC, I can change FM's default printer by changing it in the Print Setup dialog. I've tried to do this in Panther, but the pdf-writer isn't available as a selection. Is there an applescript I could send her that would toggle between the two, or do I have to go out to her office and enable all of the print dialogs?

Thanks for any help you can provide.

Paul

Version: v6.x

Platform: Mac OS X Panther

PDF is built-in to OS X, so you don't really need PDF-Writer. All you have to do is click/choose the PDF, Save As PDF option in the Print dialog (any application can print pdf). If you save this setting in a Page Setup, Print script, then it be automatic, just like any other print setup.

Remember to drop down the FileMaker settings in the Print dialog, to be sure you're printing "Records being browsed" or "Current record."

You may want to leave the dialog on in the Print step, or else it's going to save whatever name file and location you entered when you created the script.

A more advanced method would be to go ahead and print to fixed name, no dialog, then change the name with an embedded AppleScript, using the value from a FileMaker field.

You would need a complete filepath to the fixed pdf file. You can calculate this as relative path from the active FileMaker file, using Status(CurrentFilepath). But you have to use Substitute to change the text to a Mac file path, result looks like:

"Macintosh HD:Users:Me:Documents:FileMaker:FM Clients:Power:Time:Power_Time.pdf"

This would be in an unstored calculation field, _cPDF_File. The new name would also be a field, either calculated or user-entered.

The following would be in a FM script, in a Perform AppleScript step, called after you print (with perhaps a small pause to allow the file to get created before you try and change the name; as this will happen very fast).

Ex.???

tell current record of document 1

set pdf_File to cell "_cPDF_File"

set newName to cell "pdf_Name"

end tell

tell application "Finder"

set name of file pdf_File to newName

end tell

  • Author

Hey Fenton,

It sounds like no matter what I do, I'll be driving out to my clients office. I think she will have all the functionality she wants if I just enable the print dialogs.

But I'll keep that snippet of AppleScript in my archives for future use. One of these days I'll learn that stuff.

Thanks,

Paul

  • 2 weeks later...

This helped me tremendously... It's from fusion dzign. This shows you how to use the Save as PDF feature go from there for printing... it includes emailing options, but if you dont need that you still should be able to use the info included:

http://www.fusiondzign.com/downloads/downloads.htm

about halfway down where it says "Automate PDF Creation..."

  • 2 weeks later...
  • Newbies

I tried downloading that Automate_Email.sit file that is listed on the Fusion Dzgn sight, and my Stuffit Expander will not decompress it.. do you have a working copy you could email to me? This is EXACTLY the solution to the problem I'm working on right now so it really interests me.... thanks a bunch!

PS: My address is steve(at)suggitt(dot)com.

Thanks again

FileMaker Version: 6

Platform: Mac OS X Panther

AM I right that if a user prints a hard copy then the preset to "print to PDF" wont come up automatically next time a PDF script is run?

generica said:

I tried downloading that Automate_Email.sit file that is listed on the Fusion Dzgn sight, and my Stuffit Expander will not decompress it.. do you have a working copy you could email to me? This is EXACTLY the solution to the problem I'm working on right now so it really interests me.... thanks a bunch!

Yes I had that problem too

FileMaker Version: 7

Platform: Mac OS X Panther

I sent an emaul to the author and the download is fixed. However, the gist of the example is something we knew all along. In OSX, if you print to PDF and save the print settings, it will print to PDF next time.

Bruce -

Yes, while the gist is something we knew all along about saving the PDF settings it also includes the applescript to automate the name change of a file on the local machine. This was the intention of the file and the PDF printing was a bonus on OSX.

Sorry for not spotting the file error guys, but thanks to Bruce it is now fixed.

  • 5 months later...

I am having a problem with the part of the script that creates the PDF using the printing presets. In creating the PDF from within a FileMaker script (with only Page Setup and Print steps) I am told that I don't have enough memory for the operation, but if I just hit print instead and print using the same preset, it goes on to create the PDF without and error. Anyone have an idea why? confused.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.