Example of submitting a form and creating a PDF of the form itself?

Example of submitting a form and creating a PDF of the form itself?

avatar

Does anybody have an example of creating a New-UDForm, filling in some data and outputting the form to a pdf when you submit the form? Any guidance would be much appreciated!

Thank you!

Product: PowerShell Universal
Version: 1.4.6


avatar

Recommended Answer

I haven’t tested this but I’ve used the WritePDF module to create PDFs with PS before.

powershellgallery.com
You could use it in a form like this.

New-UDForm -Content {
   New-UDTextbox -Id 'txtField' -Label 'Enter Some Text'
} -OnSubmit {
New-PDF {
    New-PDFText -Text $EventData.txtField -Font HELVETICA, TIMES_ITALIC -FontColor GRAY, BLUE -FontBold $true, $false, $true
} -FilePath "Example01_Simple.pdf" 
}


Adam Driscoll
PowerShell Expert and Developer at Devolutions

All Comments (3)

avatar

I haven’t tested this but I’ve used the WritePDF module to create PDFs with PS before.

powershellgallery.com
You could use it in a form like this.

New-UDForm -Content {
   New-UDTextbox -Id 'txtField' -Label 'Enter Some Text'
} -OnSubmit {
New-PDF {
    New-PDFText -Text $EventData.txtField -Font HELVETICA, TIMES_ITALIC -FontColor GRAY, BLUE -FontBold $true, $false, $true
} -FilePath "Example01_Simple.pdf" 
}


Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Thanks! I’ll test and let you know.

avatar

I am stumbling across this now 3 years later looking to solve the same problem.

@AnonymousUser did this ever work for you?