473,761 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing to Legal Paper through windows application

Greetings,

I have code which prints a document who's attributes are saved as
flags in a database. One of the those attributes is letter or legal.
When I am printing, I use the following code, which is the ONLY way I
could come up with to reliably print to legal paper, assuming a
default of letter. There HAS to be a better way. I'm having to
loop through all paper options on the remote server's printer, until I
find the one that corresponds to legal or letter. The problem is that
this looping on a remote (networked) server is very SLOW!!!! I need
like a one line solution that doesn't require me to loop through
remote server's printer settings.

Any thoughts about how I could optimize the selection of the legal
papersize?

p = New PrintDocument

''call print page event handler
AddHandler p.PrintPage, AddressOf pd_printpage

''name the printing service (que)
p.DocumentName = "GIB Non-System Document " & strItem

With p.DefaultPageSe ttings.Margins
.Top = 40
.Bottom = 40
.Left = 40
.Right = 40
End With

''which printer
p.PrinterSettin gs.PrinterName = "\\civility \" &
strPrinterName
'paper size
Select Case strSize
Case "1"
'legal
For i = 0 To p.PrinterSettin gs.PaperSizes.C ount -
1
pkSize = p.PrinterSettin gs.PaperSizes.I tem(i)
If pkSize.Kind = PaperKind.Legal Then
p.DefaultPageSe ttings.PaperSiz e =
p.PrinterSettin gs.PaperSizes.I tem(i)
End If
Next

Case "0"
'letter
For i = 0 To p.PrinterSettin gs.PaperSizes.C ount -
1
pkSize = p.PrinterSettin gs.PaperSizes.I tem(i)
If pkSize.Kind = PaperKind.Lette r Then
p.DefaultPageSe ttings.PaperSiz e =
p.PrinterSettin gs.PaperSizes.I tem(i)

End If
Next

End Select

Try
p.Print() ' - raises printpage event
David Fields
Jul 21 '05 #1
0 1272

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3481
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can print out the form and the data that the user entered? For example, the user loads the application and a normal Windows Form asks for the user's name. When the user enters the name and clicks on the "Print" button, I'd like to print the form in the...
2
2896
by: Jurjen de Groot | last post by:
I'm about to start a new ASP.NET application, this application will generate several types of documents (PDF HTML XML-DOC) wich have to be printed at the client-side... (probably on different printers A3 and A4 type) At this time I'm trying to figure out what would be the best way to accomplish this : 1. printing through HTML in a IE windows will result in page title & nr as header and URL + Date as footer, wich is far from acceptable....
5
12823
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and then using PRINT # to print directly to the printer device. Obviously, this is not going to work under VB.NET - StreamWriter won't let you open a device like LPT1: and such. I assume I am going to have to switch to the System.Drawing.Printing...
0
1008
by: mykidisgollum | last post by:
Greetings, I have code which prints a document who's attributes are saved as flags in a database. One of the those attributes is letter or legal. When I am printing, I use the following code, which is the ONLY way I could come up with to reliably print to legal paper, assuming a default of letter. There HAS to be a better way. I'm having to loop through all paper options on the remote server's printer, until I
4
16337
by: sachin | last post by:
Hi I am working on report using print preview dialog control in windows application. Report is displayed properly in control. With paper size 850X1350 (Legal)(Lanscape mode=true) . But when page goes to printer for printing. It consider it as A4 size. and truncate printing document. any body help me...
8
17744
by: Steve Macleod | last post by:
Hi, I was wondering if anyone had a solution for printing HTML elements (especially style elements). I do not wish to make any changes to the page, other than in the <css media="print"block. I can use: select { border:1px solid #FFFFFF; } to get rid of the border, but dont know a way to get rid of the arrow
2
9976
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default printer settings to print. I wanted the print preview to appear the same for all users (i.e. a default page size of 8.5x14 (legal) and portrait mode). Many users have different printers as their default (plotters etc..) and I found that various...
9
7858
by: Gurbinder Kaur | last post by:
Hi, i have made a project for printing fee receipt. Using Windows-XP, VBasic 6.0 & Ms-Access-97. i have designed a form for prinring receipts. m paper-size is 5x10. Two copies of bills in this size. one for student and other for fee clerk. while printing on dot-matrix, form get printed, but size is A4. My problem is * how to change size to 5x10 (exactly half of printed paper width-wise) * after printing on this size, stop the printer and...
1
1287
by: gowens | last post by:
I'm definitely not a MS Access expert (more a real novice..) I have a report that I inherited for support. The user is complaining that when the report is printed - it prints on legal-sized paper (versus the letter size that was specified). The report has 1 column which is 13.47" wide. I've tried printing the report on a number of different printers (to rule out driver issues). Each time thet report is printed... it elects to use the...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.