I am unable to open the psf file in PS Studio. No errors; it just won't open. I unblocked the file too. Any suggestions?jvierra wrote:The real issue here is that old thing about printing a form from a GUI with PowerShell. There is really no internal method in forms or PowerShell, PowerShell Studio to do this.
This issue came up a few years ago and I had to apply my knowledge of printing in C# to PS. I found the old form (it was still a V1 PFF file) and cleaned up the code to make a simple demo of how to print the form on the screen to a printer. This version prints the complete form.
We could just print the client portion of the form with no "chrome" or design a custom output form and print that. It will all be very similar to using MSAccess to generate a fancy filled in form. A little extra code and we could print pages of data records on separate documents. We can even convert to PDF if you have Office 2016 installed or have installed PDF support in Office 2010.
Here is the demo form. It has both "Preview" and "Print" buttons. The code can be added to any form and it will print the form. Maybe I will create a custom control set later or you could easily do it yourself off of this demo.
See the MS documentation for the two controls for printing and print preview. They are very rich with adjustments to the resulting dialogs and behaviors.
[System.Drawing.Printing.PrintDocument] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[/url][/url][System.Windows.Forms.PrintDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[System.Windows.Forms.PrintPreviewDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
How to use Powershell Forms to create and fill printable doc
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.
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.
Re: How to use Powershell Forms to create and fill printable doc
Re: How to use Powershell Forms to create and fill printable doc
The Sapien - ScriptingAnswers.com forums. Don't worry. Your question was moved to the correct forum.bembree wrote:DevinL wrote:Unfortunately, this seems more like a scripting based question as opposed to a product specific question. If so, then this belongs in the Windows PowerShell or PowerShell GUIs forum so the community can help out with this.
That being said, they're going to need more information to go off of such as what you've got so far for your script, what you've tried and what kind of information exactly you're wanting to get about your PC's.
Are you referring to the Sapien forums or the regular Powershell forums, like TechNet?
Re: How to use Powershell Forms to create and fill printable doc
I just downloaded it and it works fine. There is nothing i the code that would prevent the file from opening. You must have PSS 2015 or later to open it.bembree wrote:
I am unable to open the psf file in PS Studio. No errors; it just won't open. I unblocked the file too. Any suggestions?
Re: How to use Powershell Forms to create and fill printable doc
Suggestion: Open file in notepad to be sure you have a good file with both opening and closing elements
<File version="2.1">
</File>
Open one of your recent PSF files and look at the version.
<File version="2.1">
</File>
Open one of your recent PSF files and look at the version.
Re: How to use Powershell Forms to create and fill printable doc
Just wanted to say thanks for posting the printing demo form, managed to use this in one of my forms yesterday sharing knowledge is great
Re: How to use Powershell Forms to create and fill printable doc
Next try to draw pictures on the page using $_.Graphics and the many drawing tools like ellipse and lines, colors and brushes. It is MsPaint in a set of metods.AdamUK wrote:Just wanted to say thanks for posting the printing demo form, managed to use this in one of my forms yesterday sharing knowledge is great
https://msdn.microsoft.com/en-us/librar ... .110).aspx