printPanel

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
kuzmao
Posts:4
Joined: Fri Feb 12, 2021 4:41 pm

printPanel

Post by kuzmao »

Hi,
I am trying to create automatic export of panels to pictures. The panels have small sizes, they are associated with the hardware devices - device icons. As far as I know, the only way is to print panels into pdf (using printPanel()) and then convert into picture format. I have encountered 2 problems with printPanel function:

1. When printing panel in -silentMode, border is alaways on though the print option is PPO_NO_BORDER. The same panel opened in the UI manager and printed without silent mode has no border.

2. For printing it is possible to set .PrinterName - with two options - printer name or file name, but not both. When file name is used, how to redirect printing on specific pdf printer? When, for example, cutePdf writer is set as default printer, printing goes still to Microsoft print to pdf (Win10). The reason for redirection is that I am not able to set custom print sizes for Microsoft pdf.

Code: Select all


const string sUiDP = myUiDpName();

dpSetWait(sUiDP + ".Print.PrinterName:_original.._value", "file:///D:/icon_file.pdf",
          sUiDP + ".Print.Landscape", false,
          sUiDP + ".Print.Background", false,
          sUiDP + ".Print.Scale", 0,
          sUiDP + ".Print.FitToPage", false);

ret = printPanel(modulName,panelName,"panelOnly", PPO_NO_BORDER);
  

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: printPanel

Post by kilianvp »

if you use file name WinCC OA generates the PDF

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: printPanel

Post by gschijndel »

With the function 'imageToFile()' you can save a panel preview as an image. The panel itself also has the function 'imageToFile', which can be used to save a loaded panel directly as an image file.

kuzmao
Posts:4
Joined: Fri Feb 12, 2021 4:41 pm

Re: printPanel

Post by kuzmao »

thank you, I was not aware of this possibility.

4 posts • Page 1 of 1