473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Setting paper size in code VB.net 2008

Hi All

Using VB.net 2008, windows forms application on Windows XP SP2

I need to set the paper size when printing to an 80mm Epson docket printer
using windows drivers

Some customers have invoices with many items on it and once past 297mm, the
rest are lost (not printed)

If I set a custom size within the printer driver (in printers and faxes)
then all works fine. If not then the roll cuts off at 297mm, regardless of
the custom size set in code, which is the default standard papersize length
I have tried the following... which DOES NOT WORK

frmpos.pd.PrintController = New StandardPrintController
frmpos.pd.DefaultPageSettings.Margins.Left = 10

frmpos.pd.DefaultPageSettings.Margins.Right = 10

frmpos.pd.PrinterSettings.DefaultPageSettings.Marg ins.Left = 10

frmpos.pd.PrinterSettings.DefaultPageSettings.Marg ins.Right = 10

Dim pkCustomSize1 As New PaperSize("New Long Roll", 315, 2000)

frmpos.pd.PrinterSettings.DefaultPageSettings.Pape rSize = pkCustomSize1

frmpos.pd.DefaultPageSettings.PaperSize = pkCustomSize1

AddHandler frmpos.pd.PrintPage, AddressOf frmpos.pd_RePrintPage

frmpos.pd.Print()

RemoveHandler frmpos.pd.PrintPage, AddressOf frmpos.pd_RePrintPage

Regards

Steve
Jun 27 '08 #1
2 9953
Hi Steve,

Firstly, you should set the page settings that are used as defaults for all
pages to be printed through the PrintDocument.DefaultPageSettings property.
Secondly, you should set PageSettings.PaperSize property for the page to a
VALID PaperSize, available through the PrinterSettings.PaperSizes
collection.

So the first step to solve the problem is to add a custom paper size in the
Printing Preferences dialog for the printer you're using.

The second step is to get the PaperSizeCollection from the
PrintDocument.PrinterSettings.PaperSizes property and loop through it to
find the custom paper size you want and then set this custom paper size to
the PrintDocument.DefaultPageSettings.PaperSize property.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #2
Hi Linda

Thanks for the reply and info

I will implement it

regards
Steve

"Linda Liu[MSFT]" <v-****@online.microsoft.comwrote in message
news:k$**************@TK2MSFTNGHUB02.phx.gbl...
Hi Steve,

Firstly, you should set the page settings that are used as defaults for
all
pages to be printed through the PrintDocument.DefaultPageSettings
property.
Secondly, you should set PageSettings.PaperSize property for the page to a
VALID PaperSize, available through the PrinterSettings.PaperSizes
collection.

So the first step to solve the problem is to add a custom paper size in
the
Printing Preferences dialog for the printer you're using.

The second step is to get the PaperSizeCollection from the
PrintDocument.PrinterSettings.PaperSizes property and loop through it to
find the custom paper size you want and then set this custom paper size to
the PrintDocument.DefaultPageSettings.PaperSize property.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jun 27 '08 #3

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

Similar topics

0
by: Pedro Feio | last post by:
Hi, I'm having a weird problem setting up the paper size in a C# Windows Forms Application. The code I'm using is something like this: PrintDocument pd = new PrintDocument(); ...
0
by: Carlos Kirkconnell | last post by:
When printing, there is a definition for a Custom paper size, the custom paper size can be setted programatically and everything is supposed to work normally. But in windows 2000 and xp, the user...
5
by: Fred Nelson | last post by:
Hi: I'm trying to write a program that will print envelopes using a HP Laserjet 4 that has three trays. In the future this program will work with other printers so I don't want to "hard code"...
0
by: william.reynolds | last post by:
I am producing reports (via Crystal XI) on a web server. I use a variety of paper sizes in Crystal to produce PDF output. In development everything works fine since I can change the paper size...
0
by: Alphonse | last post by:
Hi, I have an application that need to print a report (Crystal Report) using a custom paper size. The problem is, everytime I want to print it, I need to go to printer properties & set the paper...
4
by: Sukh | last post by:
Hi, I am tring to change the paper size from default to custom paper size. In print preview its showing my custom size but when I print it print on default paper size. Can any one help me to...
6
by: Brewtzaff | last post by:
Hello, I have a little problem to print my reports on custom sized paper. I got a db containing clubmembers, a query which selects only the needed infos to print out my membershipcards. My...
0
by: Brad Pears | last post by:
I have a vb.net 2005 application where the user can select to preview an image. The users are CAD designers and typically have their default printer set to a plotter with a large paper size etc......
23
by: Al Grant | last post by:
I have a 'printable' button to generate printable output and want this to use A3 if available, irrespective of the user's default printer setting. Is there any way to set a page's preferred...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.