Jump to content

Export selected report pages with script


---
 Share

Recommended Posts

Hello All!

I would like to export selected report pages with a script. I would like to export all pages except the last one.

I have some tries but did not find a working solution yet.

This is how my (not working) script looks like at the moment:

import gom


report_list = []
for num in range (0,len(gom.app.project.reports)-1):
    report_list.append("gom.app.project.reports[report " + str(num) + "]")

gom.script.report.export_pdf (
    file='C:/Users/tomori.m/Desktop/test.pdf',
    jpeg_quality_in_percent=100,
    reports= report_list )

 

Link to comment
Share on other sites

You got the right idea. But you should not provide the "reports" parameter as a list of strings. Anyway, "gom.app.project.reports" already is some kind of list (iterable), so you can use python slices to select ranges (e.g. "[:-1]" for your case to get all but the last one).

The code working for me looks like:

import gom

gom.script.report.export_pdf (
    file='C:/Users/tomori.m/Desktop/test.pdf',
    jpeg_quality_in_percent=100,
    reports=gom.app.project.reports[:-1])

 

Link to comment
Share on other sites

  • 1 month later...

Please sign in to view this quote.

Is it possible to lunch pdf viewer after export in the script? I tried to record with the check, but there isn't the parameter after recording.

Thank you very much.

Link to comment
Share on other sites

 Share

×
×
  • Create New...