How to print/export several screens in a single printout/pdf
Hi Board-Community,
I would like to print and/or export several screens. Result should be one printout resp. one pdf file.
In my approach I use a container with "print AS SINGLE OBJECT", Therefore one screen results in one page. Is there any sophisticated appraoch to print /export these screens in one procedure? Another fact that makes it more complex is that one screen should be printed by pager all the others not.
My current appraoch would lead to a new screen with all containers. However, it seems to be a bit weak since it would be necessary to duplicate all the containers and create a dedicated screen for printing/exporting only and it is not possible to distinguish print by pager and not by pager.
Any good suggestion how to solve this?
Thanks.
Regards
Tomi
Answers
-
Hi Tomi Kalin,
my first idea would be to use a PPT-Export - build up the PPT like you need it to be and then export your objects into that PPT using Office Refresh. Although I'm not quite sure how that'll work with Pagers resulting in screen-objects being exported per dimensional value. The second disadvantage of this approach might be that you'd have to launch an external command to convert the PPT into a PDF.
But after all - maybe this helps.
Kind Regards
Helmut
6 -
Hi Helmut Heimann,
many thanks. I will go for your approach with the BOARD Office-Addin.
Regards
Tomi
0 -
Hi Tomi,
as a general principle you can create, as you say, a folder container with different objects in it (also panels containing other objects) - this will output all the different objects inside the folder into a single PDF.
If it's not enough, another option is to go for Word / PPT / Excel addin, which also gives great flexibility in terms of additional formatted comments and more "ribbons".
Just to add another option to the list, I did create a very precise printout for 2 different customers, with several pages getting exported to PDF.
The approach I followed with the customer was to create several screens, with a procedure controlling the export to PDF of the screens which also had parameters to print / not print screens based on some "setting" cubes inside BOARD itself.This procedure would then print 1 file per screen (in your case you can have a screen with the cycle by pager, then other screens). At the end, the files exported were getting merged with a simple batch command.
The whole procedure runs scheduled on the BOARD Server (on premise only, this is not applicable on the cloud).Tool used to merge is open source, called GhostScript.
You can download from Ghostscript websiteSample command is:
gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=Merged.pdf -dBATCH @filelist.txt
Where filelist.txt is a file containing all the files to be merged, separated by space:
test1.pdf test2.pdf test3.pdf
Please also see this full implementation with CPDF and powershell scripts built by interested typ starting from this concept:
10 -
Hi Michele,
many thanks. I think this would fully cover the requirement.
Could you provide me thebatch file as a sample. Do I need any additional freeware software/tool to merge the pdfs?
BR
Tomi
3 -
Added details to original answer - hope it helps!
2 -
Some crucial steps to achieve a result:
In BOARD:
- export for screens with "by pager" option set has to be setup in the screen itself (BOARD-Button > Export to PDF > Config) and additionally in the procedure. However BOARD takes for such screens the path set in the screen and ignores this in the procedure
In Batch file:
- Use full path instead of gswin32c
- do not use spaces (e.g. use "_" instead of " " in the fienames) in the batch, otherwise GS will stop working
- found no solution yet to get the @listname working
2 -
Hi Tomi,
yes there might be some tweaking to do to my old script .
If you add ghostscript installation path to the environent variables, you don't need to call the full path to the program - i usually add that.
You can use spaces if you use put the filename in double quotes (e.g. "filename with space.pdf")
for the filelist, i remember that was working correctly - just check How to use Ghostscript in case. I cannot check the live example now, but will try to do asap
Michele3 -
Hi Helmut Heimann ,
I have tried out your suggested solution. Unfortunately, the addin comes with too many adaptions when you copy&Paste Layouts from board to ppt via addin. Means each report can be pasted to PowerPoint. But the whole design of the report has to be redone: changing colours, switching from lines to waterfall, etc. Therefore, this was no longer an option , unfortunately. However Michele’s solution works fine and would recommend his approach for such requirements.
Br
Tomi
1 -
Can i just add a note to that Helmut Heimann and Tomi Kalin
Addin is ALWAYS my preferred solution, when requirements are quite "free" on the formatting part. I find Word and Powerpoint addins to be invaluable to prove BOARD capabilities when it comes to "old-style" printed reporting - i still think navigating our HTML5 interface (or a BOARD Presentation) is better than a powerpoint!My solution goes out of BOARD integrating with external software, that makes it not applicable if you don't have basic IT knowledge, thus being a bit limited in audience (but that's why consultancy exists ).
Michele
4 -
Hello Tomi Kalin
Could you provide us the script text you wrote in the batch (.bat) file ?
I am trying to use Ghostscript (on a windows local machine) and am struggling on how to use the following folders- where Ghostscript is installed and the gswin64c.exe file is : C:\Program Files\gs\gs9.22\bin
- where the PDFs exported from Board are stored: C:\...Board\Export
- where the output PDF after the merge is stored: C:\...Board\Export
- where the batch file is stored: C:\...\Board\Job
Thanks in advance.
Furthermore, has anyone experimented the following issue : I merge 4 PDFs, which have all their own page number in the footer. In the output single pdf file, these footers stay as is, i.e. the output file has several "page 1", "page 2" etc... ?. Any solution ?
1 -
Hi interested typ,
i used not to print the page numbers and add them directly through the merge script. I'd like to tag Neil Townsend as he has a working copy of those scripts and maybe can put the full example here...
Michele
0 -
As Michele says we had a capsule that generated quite complicated PDFs - different numbers of pages and different page order depending on the selection criteria. We ended generating single page PDFs for each page and then using a batch file to merge all the pages together and then add the numbers. It uses Ghostscript to merge the pages into one single document and then CPDF to add the pages numbers. The CPDF command:
cpdf -add-text "%%Page of %%EndPage -bottomright 15pt -font "Arial" -font-size 10 <inputfilename> -o <outputfilename>
0 -
Thank you very much Neil Townsend
Would you also have the Ghostscript command to share here ("anonymized") ?
Regards
0 -
gswin64c.exe -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=out.pdf @filelist.txt
Where filelist.txt is a text file that contains the name of all the pages (as individual pdf docs) in the order you want them to appear.
Neil
0 -
Thank you Neil Townsend.
the .bat script (let's call it ghostscript.bat) is I guess located in the \Board\Job folder of your application, correct ?
Is filelist.txt also located in this same folder ?
Regards,
1 -
So I got it done!
Sorry for using an already "successfully closed" topic, I just wanted to document here the whole process, also because I have need some time to get the several scripts described above together and working.
- Let's assume a BOARD procedure has generated several Export PDFs from several screens (with NO pagenumber parameter set in the capsule print template)
- The reference folder (for relative paths, which are more handy to work with, because of several environments like dev, test, prod) is Board\Job.
- the first thing is to get the list of the pdf files' names, and in a way that it is generated each time dynamically.
- Let's assume these files are exported into a Board-independent folder, e.g. ../../Export and their names are
- Report1.pdf
- Report_ABC.pdf
- ManyOtherReports.pdf
- ...
- I called the script collecting these names (including full path) FileList.ps1, it has one line and is saved in the Board\Job Folder:
Get-ChildItem -LiteralPath ../../Export/ | Where-Object {$_.PSIsContainer -eq $false} | Select-Object -ExpandProperty FullName | Set-Content -LiteralPath "../../Export/FileList.txt"<span class="line-numbers-rows"><span></span></span>
- Since BOARD can only call .bat files, I created the file Start_Powershell_FileList.bat which has this code:
del ..\..\Export\FileList.txt<br>del ..\..\Export\All_Reports_without_pagenumber.pdf<br>del ..\..\Export\Reports_Merged.pdf<br>Powershell.exe -executionpolicy remotesigned -File FileList.ps1<span class="line-numbers-rows"><span></span><span></span><span></span><span></span></span>
- Result is a text file having this content:
C:\BI\Export\Report1.pdf
C:\BI\Export\Report_ABC.pdf
C:\BI\Export\ManyOtherReports.pdf
- Let's assume these files are exported into a Board-independent folder, e.g. ../../Export and their names are
- Having the list of files, we are ready to use a) Ghostscript to merge the files and b) CPDF to add the page number after the merge at the bottom right of each page.Note that Ghostscript needs to be installed like a standard Windows software, whereas CPDF doesn't need to be installed on Windows. I placed the cpdf.exe file into the Board\Job folder
- The script (called Merge_Files.bat) has two lines.
- The first line merges the pdf files according to FileList.txt
- The second line adds the page number at the bottom right of each page
"C:\Program Files\gs\gs9.22\bin\gswin64c.exe" -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=../../Export/All_Reports_without_pagenumber.pdf @"../../Export/FileList.txt" <br>cpdf.exe -add-text "%%Page of %%EndPage" -bottomright 40pt -font "Arial" -font-size 8 "../../Export/All_Reports_without_pagenumber.pdf" -o "../../Export/Reports_Merged.pdf"<span class="line-numbers-rows"><span></span><span></span></span>
- The result is one PDF file in the ../../Export folder, having all the PDF reports exported from BOARD and a proper page number in the footer. This file may be moved to another folder, sent by email, etc...
- To achieve this, the following files are stored under Board\Job:
I hope this can help.
2 -
Amazing job, well done - i'll insert a link into my original correct answer to your guide as it's really complete.
Neil Townsend thanks for the help
1 -
Wow. Thanks for sharing your solution. I like that you were able to use powershell to get the list you needed. This seems like a very logical flow now and I appreciate it probably took much effort to simplify it to these steps.
1