I have written an application that requires me to print some forms either to the default printer or to PDF.
On my computer the code prints successfully to my Epsom Stylus Photo R3000 printer or to PDF using Microsoft Print to PDF .
However, when I load the code onto three other laptops, including my own, the forms are printed truncated with the last few lines missing. (Both Printer and PDF Printer)
The code I am using is ;
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles PrtAvlBut.Click
'Prints availability form when button clicked
PrtAvlBut.Visible = False
Array.ForEach(Me.Controls.OfType(Of TextBox).ToArray, Sub(tb As TextBox) tb.DeselectAll())
PrintForm1.PrinterSettings.DefaultPageSettings.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
PrtAvlBut.Visible = True
Me.Close()
End Sub
Although the form is clearly shown on the screen, the Print Preview shows the form to be truncated.
My original code used ClientAreaOnly instead of Scrollable, which only prints that part of the form shown on the screen. As the second user had a small and low resolution screen only two thirds of the form was visible but it did print correctly. i.e. printing the two thirds shown on the screen.
I have no idea where to start looking for a solution.
What I have tried:
I tested my latest solution with my screen resolution set lower to mimic the second users laptop. Although I could not see all of the form , it still printed correctly i.e. the whole form.
I also, set all the margins to "0", just in case this was the cause of the failure but no success.