Local DotMatrix Lineflow Single Line Print

  • Thread starter Thread starter bclegg
  • Start date Start date
B

bclegg

Hi,
I have a Monitoring application that needs to output single line
summaries to a local dot matrix printer loaded with line flow. ie. It
will have exclusive use of the printer which is connected to LPT1.

I need to get the normal number of lines to each page. ie 60 summaries
onto a 66 line lineflow page

Am I restricted to the Printdocument object and graphics printing or
is there a way to do a single line text print?

If it is Printdocument object then how do you prevent page feed at the
end of the document?

Thanks
Bob
 
Hi Bob,

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter, and I
will be assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.

From your description, I understand that you wants to print just one single
line text onto the page and prevent page feed a the end of the document.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think you may try to use the WritePrinter API to write data to the
printer directly, when you want to end the page you may try the
EndPagePrinter API.

[NOTE]
WritePrinter is a microsoft-provided local print provider that writes RAW
data from a specified buffer location to a SPECIFIED printer. all the print
control commands sent by this API are specific for specified printer only,
and windows can NOT print windows-based font (WYSIWYG) by calling this API.

WritePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo
l_7zqq.asp

EndPagePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo
l_52r6.asp

Here is a VB.NET sample you may take a look.
HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
http://support.microsoft.com/?id=322090

Please Apply My Suggestion Above And Let Me Know If It Helps Resolve Your
Problem.
You may also try some reporter tool which will implement similar function.
e.g. Crystal Report shipped with VS.NET

Best regards,

Perter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Peter,
Thank you for your response,
This is just what I need.
Much appreciated.
regards
Bob
 
Hello Peter,
If you are still monitoring this thread,
Could you elaborate on the instruction to:
'Add the following code inside the main application namespace but
outside any class definitions.

The only way I could get the code to compile
Was to create a class and overwrite it with the RawPrinterHelper code.

The Test application appears to work in that it works it way through the
appropriate routines in RawprinterHelper but the printer (local dot
matrix) does not respond.

(Printer is OK given that a DOS dir > prn works)
thanks
Bob said:
Hi Peter,
Thank you for your response,
This is just what I need.
Much appreciated.
regards
Bob

Peter said:
Hi Bob,

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter,
and I will be assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to print just one
single line text onto the page and prevent page feed a the end of the
document. Have I fully understood you? If there is anything I
misunderstood, please feel free to let me know.

I think you may try to use the WritePrinter API to write data to the
printer directly, when you want to end the page you may try the
EndPagePrinter API.

[NOTE]
WritePrinter is a microsoft-provided local print provider that writes
RAW data from a specified buffer location to a SPECIFIED printer. all
the print control commands sent by this API are specific for specified
printer only, and windows can NOT print windows-based font (WYSIWYG)
by calling this API.

WritePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo

l_7zqq.asp

EndPagePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo

l_52r6.asp

Here is a VB.NET sample you may take a look.
HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
http://support.microsoft.com/?id=322090

Please Apply My Suggestion Above And Let Me Know If It Helps Resolve
Your Problem.
You may also try some reporter tool which will implement similar
function.
e.g. Crystal Report shipped with VS.NET

Best regards,

Perter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Hello Peter,
I have done some further work on this.
The code works when printing to a networked HP1200 Laser but not when
using the Panasonic KXP-1180 Dot matrix on LPT1.
Any ideas?
Regards
Bob said:
Hello Peter,
If you are still monitoring this thread,
Could you elaborate on the instruction to:
'Add the following code inside the main application namespace but
outside any class definitions.

The only way I could get the code to compile
Was to create a class and overwrite it with the RawPrinterHelper code.

The Test application appears to work in that it works it way through the
appropriate routines in RawprinterHelper but the printer (local dot
matrix) does not respond.

(Printer is OK given that a DOS dir > prn works)
thanks
Bob said:
Hi Peter,
Thank you for your response,
This is just what I need.
Much appreciated.
regards
Bob

Peter said:
Hi Bob,

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter,
and I will be assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to print just one
single line text onto the page and prevent page feed a the end of the
document. Have I fully understood you? If there is anything I
misunderstood, please feel free to let me know.

I think you may try to use the WritePrinter API to write data to
the printer directly, when you want to end the page you may try the
EndPagePrinter API.

[NOTE]
WritePrinter is a microsoft-provided local print provider that writes
RAW data from a specified buffer location to a SPECIFIED printer. all
the print control commands sent by this API are specific for
specified printer only, and windows can NOT print windows-based font
(WYSIWYG) by calling this API.

WritePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo

l_7zqq.asp

EndPagePrinter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspo

l_52r6.asp

Here is a VB.NET sample you may take a look.
HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
http://support.microsoft.com/?id=322090

Please Apply My Suggestion Above And Let Me Know If It Helps Resolve
Your Problem.
You may also try some reporter tool which will implement similar
function.
e.g. Crystal Report shipped with VS.NET

Best regards,

Perter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Hi Bob,

Thank for your reply.

Since the code works when printing to a networked HP1200 Laser printer, to
isolate the problem,I think you may try to make a test with the file in the
KB article below, so that we will know where the problem is.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;138594
HOWTO: Send Raw Data to a Printer by Using the Win32 API

You may have a try and let me know the result.
If this does not work, can you describe the what error do you get? Does the
printer print out something messy or doesn't do any thing?

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Peter,
Thanks
again for continuing to monitor this thread.
I tried to pull my subsequent 'help' message but too late.
All is well.
I had to append 'vbNewLine' to the test string to get
the printer to output it. It was just sitting in the buffer.
regards
Bob
 
Hi Bob,

I am glad that you make your printer work.
:)

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top