Forum Discussion
Unable to print to pdf double copies (to a single file) using powershell
I am able to print using Microsoft Print to PDF option when using GUI. Shouldn't that work when use powershell?
I get the following error
Cannot convert argument "image", with value: "System.Drawing.Printing.PrintPageEventArgs", for "DrawImage" to type "System.Drawing.Image": "Cannot convert the "System.Drawing.Printing.PrintPageEventArgs" value of
type "System.Drawing.Printing.PrintPageEventArgs" to type "System.Drawing.Image"."
At line:29 char:5
+ $args.Graphics.DrawImage($page, 0, 0, $page.Width, $page.Height)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
The property 'HasMorePages' cannot be found on this object. Verify that the property exists and can be set.
At line:30 char:5
+ $args.HasMorePages = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
singhn83 WOW , Going through your errors it seems there is a lot to debug here.