469,926 Members | 1,903 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

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 9534
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pedro Feio | last post: by
reply views Thread by Carlos Kirkconnell | last post: by
reply views Thread by william.reynolds | last post: by
4 posts views Thread by Sukh | last post: by
23 posts views Thread by Al Grant | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.