[Má...] Posted April 21, 2022 Share Posted April 21, 2022 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 More sharing options...
[Th...] Posted April 21, 2022 Share Posted April 21, 2022 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 More sharing options...
[Má...] Posted April 22, 2022 Author Share Posted April 22, 2022 Thanks for the answer! Link to comment Share on other sites More sharing options...
[Ma...] Posted June 13, 2022 Share Posted June 13, 2022 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 More sharing options...
[Ja...] Posted June 13, 2022 Share Posted June 13, 2022 Hey marco, maybe the following post on stackoverflow forum is helpful https://stackoverflow.com/questions/19453338/opening-pdf-file I have had success in the past with the "import webbrowser" option. Stackoverflow is a great resource for coding ideas Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in