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 Helmut Heimann,

     

    many thanks. I will go for your approach with the BOARD Office-Addin.

     

    Regards

    Tomi

  • 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

  • Added details to original answer - hope it helps!

  • 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

  • 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


    Michele

  • 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


  • 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

  • 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 ?

  • 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

  • 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>

  • Thank you very much Neil Townsend

    Would you also have the Ghostscript command to share here ("anonymized") ?

     

    Regards

  • 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

  • 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,

  • Previous Member
    edited March 2020

    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.

     

    1. Let's assume a BOARD procedure has generated several Export PDFs from several screens (with NO pagenumber parameter set in the capsule print template)
    2. The reference folder (for relative paths, which are more handy to work with, because of several environments like dev, test, prod) is Board\Job.
    3. the first thing is to get the list of the pdf files' names, and in a way that it is generated each time dynamically.
      1. 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
        • ...
      2. 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>
      3. 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>
      4. Result is a text file having this content:
        C:\BI\Export\Report1.pdf
        C:\BI\Export\Report_ABC.pdf
        C:\BI\Export\ManyOtherReports.pdf
    4. 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
    5. The script (called Merge_Files.bat) has two lines.
      1. The first line merges the pdf files according to FileList.txt
      2. 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>
    6. 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...
    7. To achieve this, the following files are stored under Board\Job:
      image

    I hope this can help.

  • 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

  • Unknown
    Unknown Active Partner

    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.