Printing

R

Rand

Hello anyone,

Situation: I want to print 1 or x mailing continuous form
labels 1" X 3.5" then change to a different name and print
again.

Everything works fine except for problem below.

Problem: Unwanted form feed after printing.

VB.Net
Printing using PrintDocument Component, PrintPage
Graphics.Drawstring as argument. Called by a form
buttom.click with PrintDocument1.Print

I turned off printer auto FF = no fix
Labels nor Custom are printer options

Tried send a string of escape codes to set printer form
length to 1 ", but couldn't get the syntax correct or the
generation gap between the printer and the software is too
great.

VB Page Size was next target, set height to 100 (1")to
limit the blank labels being ejected , get
exception " can't change paper size unless it's kind is
set to "Custom. Kind is Read Only

Set or think I set the PaperKind to custom(of which Kind
is a value)But Kind does not inherit the new PaperKind
value. Used Property Method.

I'll LPrint or Printer.Print over this new stuff.

All or any help appreciated!!!

Thanks

Randy



..
 
B

Bharat Patel [MSFT]

Rand,

You will need to use API calls for sending Escape sequences to the printer.
Check out the following article for sample code.

322090 HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
http://support.microsoft.com/?id=322090

Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
G

Guest

Bharat

Thanks for the info. However I'm more interested in
knowing if a Form Feed is sent when the
PrintDocument.Print is called and how to suppress it.

Thank you
Rand
 
B

Bharat Patel [MSFT]

Rand,

Yes the FormFeed is sent every time the PrintPage event is complete.
You cannot suppress it but you can print multiple labels in one PrintPage event.

Check out the following MSDN article to understand how this works.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html
/printwinforms.asp?frame=true

Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
G

Guest

Thanks again, Bhara

Could you direct me in setting the PaperKind to custom, is PaperSize.Kind automatically updated

I'm trying to set the page height but get an exception ".......Kind must be Custom. I set PaperKind to Custom but Kind does not reflect the change

Thanks for the help

Rand
 
B

Bharat Patel [MSFT]

Randy,

I don't think it will work because of the bug. Check out the following post
for more details.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=c1qrDmeBDHA.255
6%40cpmsftngxa06.phx.gbl

Refer the following VB6 article for AddForm API sample:

282474 HOWTO: Print Using Custom Page Sizes on Windows NT and Windows 2000
http://support.microsoft.com/?id=282474


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
G

Guest

Bharat

Thanks for providing all the references

is the final conclusion that you can not set PAPER SIZE to a Custom size in VB.NET 2002 running Windows XP pro

I have verified that PaperKind is set to Custom , but does propagate to PaperSize.Kind as it should. Is there no patch or fix for this bug.

I'm relatively inexperienced with VB.Net , however:I experimented with Refresh and enum Refresh Properties trying to force PaperSize.Kind to Update to the current value of PaperKnd of which it s one value. Probably was stupid of me.

Presently I'm accumulating in an array, the labels for printing until there is a page full, then printiing. Not working right yet but it should

Randy
 
B

Bharat Patel [MSFT]

Randy,

This issue has been fixed in .net framework 1.1
You may try running your application against 1.1 after installing 1.1 framework.

Refer the following link on how you can run your app with 1.1

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/s
idexsidenet.asp

Other than that there is no work around except to follow the instructions in my
earlier posts.

Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
J

JC57

Ok. Here is a way to do it.

Private WithEvents pf As New Printing.PrintDocument()

Dim customSize As New Printing.PaperSize("custom size", 350, 100)

pf.DefaultPageSettings.PaperSize = customSiz


-
JC5
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top