Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2264 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have many scripts that are generating a PDF using data from records in particular tables using several layouts to display all the data (lots of fields).  We've always done the scripts just plugging away from beginning to end, hard coding the finds and sorts needed, switching from layout to layout, setting the print parameters for each layout, continuing until finished.  My dream is to generalize/modularize these as much as possible.  I have a couple of questions based on things that look like potential issues. (I think I know how to pass find and sort parameters and which layout to use for each page I need to generate, so I'm good there.)

The first issue has to do with page setups when switching layouts.  Because some layouts are more crowded than others, they have to be set at different scales for printing.  Does using "Print" use the print setup (orientation and scale) saved with the layout, vs. using "Print Setup" and setting the scale in the script before running the "Print" step?  (I know, really elementary question, but I've never tested it, always have used the "Print Setup" step!) Otherwise, is there a way to pass this info, say, using variables?

Also, if you are creating a PDF, can you use "Append" on the first step, or will that create an error if the file has not yet been created?  Also something I've just never tested.

Many thanks in advance.

Posted

Yes, you need to precede the Print step with Print Setup to restore the page settings you want.

I have never tried the Append option on the first PDF created so I don't know either. Let us know what you find out when you try it.

Posted

Print options are not saved with layouts. You can specify multiple Print/Print Setup steps within a single script, though, so one way you might modularize is to send a parameter like 'landscape 100' or 'portrait 75' to a script:

Set Variable[ $param ; Get(ScriptParameter) ]
If[ $param = "landscape 100" ]
 . Print Setup ( ... )
Else If[ $param = "portrait 75" ]
 . Print Setup ( ... )
etc.

There's no great advantage over using individual scripts -- might be just as well to create a dozen print setup scripts, even if they're just a single line. Throw them in a folder, use a really obvious naming scheme and don't even worry about parameters.

  • 1 year later...
Posted

I decided to check back here.... yes "append" works as a first step.  If a pdf file with the assigned name doesn't exist already, it gets created.   👍

One thing you do have to watch for is if you run the script again - if I have to regenerate the PDF I make sure I've moved the old one to the trash, else the new stuff gets appended to the old PDF.

Fitch, thanks for the idea of making a general layout script that I can call and pass parameters to.

This topic is 2264 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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