Limit on the number of Data Tiles

Is it possible to have more than 9 data tiles in a form?

As a workaround for not having an overflow() feature, I create Data Tiles programmatically as needed and use arrayrange to split the data for each tile created. Some tiles are created on top of pre-existing formatted reports which include part of the overflow text, but are only printed or PDF if needed.

This is working great, but I’m limited to 9 pages only. I can define a data tile as “Data (Page 10)” , but it doesn’t print.

Someone may have a better option, but if all else fails you could further divide the data and send the extra pages data to extra forms to be printed, each within the data tile number limit. I don’t know how many pages you’d potentially need but you might be able to programmatically clone additional forms as needed.

Thank you John, I was originally printing from different forms. It works great if printing only, but not if generating PDFs. The PDFs are generated as separate files for one document.

I yet have to find a reliable way to merge PDF files with Panorama. This all has to be done within the program, there is no user intervention.

You’re already using the ArrayRange( as I’d suggest. But instead of using more data tiles, you can keep doing PrintOneRecord while using the same tile as you loop through the array.

I save all the PDFs to a common folder. Then I use a Python script that joins pages from a collection of PDF files into a single PDF file. It works great and has proven to be quite reliable for any number of pages.

If you’re interested, I can post the python script. It need to be saved to an accessible location and run as a ShellScript. I’ve not yet managed to load the whole script into Panorama so it’s no longer an external script reliant on properly defined paths, etc.

Thank you Jim!, If you don’t mind, that will save me a lot of time. I attempted with Applescript, only to find that it was overly complicated for this simple task.

I was trying to recall where I first discovered it, and found my notes. You already have it available. Just drag a copy from here and put it to work:
/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py

Thanks Jim! I found it, I will give it a try.
You are very helpful, as always!

A little more to go with that…I worked from this:

join [–output ] [–append] [–shuffle] [–preview] [–verbose]

And here is how it gets used:

$ python ‘/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py’ -o ‘/path/to/output.pdf’ ‘/path/to/input1.pdf’ ‘/path/to/input2.pdf’

Where /path/to/input1.pdf and /path/to/input2.pdf are the PDF files to be combined, and /path/to/output.pdf is the new combined PDF. /path/to Shell

My procedure in Panorama, although I’ve dynamically built lvPDFFiles before it gets here:

Local lvPyPath, lvPDFFiles

lvPDFFiles = ‘/Path/To/Destination/Resulting.pdf’ ‘/Path/To/Source/Temp1.pdf’ ‘/Path/To/Source/Temp2.pdf’ ‘/Path/To/Source/Temp34.pdf’

lvPyPath = “'”+posixpath(pathstr(dbinfo(“folder”,“”))+“join.py”)+“'”

ShellScript |||‘|||+lvPyPath+|||’ -o |||+lvPDFFiles

I think it would not be too difficult to allow more than 9 extra tiles. I have added this to the list of proposals, and I will probably implement this fairly soon.

I don’t have a link to it at the moment, but I know there is a readily available shell tool that can perform operations on PDF files, including merging PDF and splitting PDFs. Ok, I did a quick Google search and this looks like it might be the best option.

Please note that I have never tried this myself, and there definitely are other options.

Way back in 2022 I was using the Python methods noted here. Then there were system updates, Python updates etc and changes were made.

What worked before needed tweaking and my methods have continued to evolve.

Currently the script below is merging several PDFs into one for me. I’m running it on Sonoma with Python 3. The Python script is within a Panorama procedure so there’s no external script to be called. It does require that PyPDF3, a Python library, is installed.

The Python script loops through like-named files with sequentially numbered prefixes.
Screenshot 2023-10-23 at 3.14.04 PM

With Local Variables lvPDFPath containing the file path, lvSuffix containing the common part of the files names, and lvSaveAs containing the desired name of the finished PDF, this is the script as it resides in my Panorama procedure.

Be sure that your file path contains slashes vs colons: / not :.

lvPDFPath = ?(lvPDFPath endswith "/",lvPDFPath[1,-2],lvPDFPath)

Let lvSaveAs = lvPDFPath+"/"+lvFile+?(lvFile endswith ".pdf","",".pdf")
Let lvResult = ""

python |||
#!/usr/bin/python3
import PyPDF3, os

os.chdir($«lvPDFPath»$)
#print(os.getcwd())

pdfiles = []

for filename in os.listdir('.'):
        if filename.endswith('.pdf'):
                if $«lvSuffix»$ in filename:
                        pdfiles.append(filename)
                        
pdfiles.sort(key = str.lower)
#print(pdfiles)
pdfMerge = PyPDF3.PdfFileMerger()
for filename in pdfiles:
        pdfFile = open(filename, 'rb')
        pdfReader = PyPDF3.PdfFileReader(pdfFile)
        pdfMerge.append(pdfReader)
pdfFile.close()
pdfMerge.write($«lvSaveAs»$)|||,lvResult

When completed, my Panorama procedure removes all of the individual PDFs and only the finished product is left behind.

Thanks for this Jim, I’m sure this will be useful to someone down the line.

FYI, Panorama does now support up to 25 data tiles (this was added a year or so ago), hopefully solving Hugo’s original problem without needing Python.