PowerShell form print

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
vadocit
Posts: 10
Last visit: Thu Oct 19, 2023 8:19 am

PowerShell form print

Post by vadocit »

Hello

I created a form in Power Shell Studio 2015 , I want to be able to print the form with the results , I have search but cant find nothing anyhelp will be appreciated,

Thanks in advance
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: PowerShell form print

Post by davidc »

Do you want to print text in a textbox or the whole form itself?

Note: PowerShell has an Out-Printer cmdlet that allows you to print text.
David
SAPIEN Technologies, Inc.
User avatar
vadocit
Posts: 10
Last visit: Thu Oct 19, 2023 8:19 am

Re: PowerShell form print

Post by vadocit »

the whole form if possible
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: PowerShell form print

Post by davidc »

Here is a C# example on how to print the form itself. You will need to use a PrintDocument object:

https://social.msdn.microsoft.com/Forum ... arpgeneral
David
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell form print

Post by jvierra »

Here is a PowerShell example of how to do document printing of a form.
Attachments
Demo-PrintDocument3.psf
(15.65 KiB) Downloaded 256 times
User avatar
vadocit
Posts: 10
Last visit: Thu Oct 19, 2023 8:19 am

Re: PowerShell form print

Post by vadocit »

thanks
I try to open the Demo-PrintDocument3.psf but I get this error
Demo-PrintDocument3.psf: Unable to load Demo-PrintDocument3.psf (File Format: v2.1), because it was created with a different version of SAPIEN PowerShell Studio 2015.
Demo-PrintDocument3.psf: Unable to determine object class.
I have Power Shell Studio 2015 version 4.2.89

thanks again
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell form print

Post by jvierra »

You version of PSS is too old. Open the file and change the format to 2.0 and it should work with your version.
This topic is 6 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked