I am trying to print a dataviewgrid from a GUI I made but I am having trouble with it printing. Here is the code I have for the printing.
$print = New-Object System.Windows.Controls.PrintDialog
$printPaginator = New-Object System.Windows.Documents.DocumentPaginator
$print.CurrentPageEnabled = $true
$print.UserPageRangeEnabled = $true
if ($print.ShowDialog() -eq $true)
{
$print.PrintDocument($printPaginator, "test")
}
ERROR: New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Windows.Documents.DocumentPaginator. MainForm.psf (452): ERROR: At Line: 452 char: 20 ERROR: + $printPaginator = New-Object System.Windows.Documents.DocumentPaginator ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ERROR: + CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException ERROR: + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand ERROR: