Mainframe Direct Connection Screenshot Issue

While using the Mainframe Hostexplorer or Pcomm Emulator , I was able to perform all of the action using the activities in UiPath except for capturing screenshots using CTRL+P ( Activity - Send Control Key ) as it does not open any window to save the screenshot file like it does if we press the CTRL+P Key manually on a mainframe session . Another thing is if I want to change the color of the Direct Connection then are you aware of where the color settings needs to be changed from? , as we are passing the .exe link in the application file path.

Hey Prateek,

There is an activity called ‘Take Screenshot’ activity which might work. If that doesn’t work and if the main frame application you are using allows scripting. You can write a code that will capture and save screenshot which we can execute using Invoke code activity from UiPath.

Hope the suggestion helps.!

Happy Automating…!!

Thanks,
Gautham.

Hi @Gautham_Pattabiraman ,

Thank you for the suggestion. I did try the ’ Take ScreenShot’ activity and it does work but we were looking to save the ss as a .pdf file and this activity creates an image. One workaround I found was using Word Activities to convert the .png screenshot to .pdf but it adds a lot of empty space in the whole blank page of the docx. If you have a better way of convert .png to .pdf let me know .

Regards,
Prateek.

Hey Prateek,

Instead of Word Activities try, the “Invoke Method” activity.
Select the target object as System.IO.File and Set the Method Name to WriteAllBytes`.
The first parameter should be the path where you want to save the PDF file, and the second parameter should be the bytes of the PNG file.

Steps in workflow:

  1. Take a screenshot and save it as a PNG file.
  2. Read the PNG file as bytes using the “Read Text File” activity with the “Byte” option selected.
  3. Use the “Invoke Method” activity to write the bytes to a PDF file.

Hope this helps you to write the pixels without any blank space in PDF.

Do try and let me know.!

Thanks,
Gautham.

Hi @Gautham_Pattabiraman ,

Thank you for your input, While trying this method, I am receiving this error.

Also just to verify, I do not see any “Byte” Option available in the properties of the " Read Text File " activity.

I am attaching the .zip containing the only .xaml where the code is located for ease.
PNGtoPDF.zip (2.3 KB)

If you could please review it, I would be of immense help.

Regards,
Prateek.

Hey Prateek,

The method I proposed earlier isn’t working the way I expected it to be. Even when I was trying to resolve the issues the pdf generated is always corrupted in that method. However found another alternative which may work, Please take a look at the attached zip.

Hope this works for you.!

Png2Pdf.zip (126.2 KB)

Thanks,
Gautham.

Hey @Gautham_Pattabiraman ,

Yeah, I was using the same Activity but the issue is it creates a lot of empty space in the PDF file along with the image. So I was hoping there would be something direct that would be able to convert only the image to the pdf file. Thanks for your help. I am thinking of exploring C# library option. If you find anything else, let me know thanks.