Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 21-Jun-17 11:26am
v2
Comments
Richard MacCutchan 21-Apr-17 5:07am    
You need to check the characteristics of the selected printer, and the selected page size, to find out how much effective space there is on each page.
Dave the Golfer 24-Apr-17 17:06pm    
Richard
Thanks I will look into that. I have now added a line of code to define the paper size. Need to test on my colleague's computer which I hope to do in the next day or so.
Dave the Golfer 5-May-17 12:21pm    
Unfortunately the setting of page size did not solve the problem. I thought that the Print to PDF worked but that proved to be incorrect as the PDF Print was the same as printing directly to the HP Deskjet 2540.
Need to get in touch with HP somehow, as I am not an HP owner.
Dave the Golfer 5-May-17 12:29pm    
Unfortunately the setting of page size did not solve the problem. I thought that the Print to PDF worked but that proved to be incorrect as the PDF Print was the same as printing directly to the HP Deskjet 2540.

As it is a problem with both printers I am assuming that the HP printer is not the problem. It must therefore lie within the laptop! No idea where to start looking!!!
Dave the Golfer 5-May-17 16:06pm    
Looking further at the problem I changed my display resolution to same as my end user (1366x768). With this setting I can only see part of the form , in fact that part that my end user prints on the printer or creates as PDF. Which suggests that the command SCROLLABLE does not seem to work on his laptop.

1 solution

Need to load some Microsoft prerequisites.
Question closed
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900