Sending binary data to client printer via web page.

G

Guest

I hope I posted this to the correct group. If not, please let me know and I
will get it posted in the correct section.

I have a web application developed in ASP.NET using C# for the code behind.
I need to be able to print shipping labels from a web page within this
application. The shipping label data is pulled from a 3rd party application
and comes in binary format specific for certain brands of label printers. I
have a class library written (in C#) to handle sending the raw data directly
to a selected printer that is compiled into a seperate dll. I am in need of a
way to be able to instantiate an object from this class library and call a
method that will send the raw data to the client's printer. My assumption was
that I would be able to accomplish this via an ActiveX approach and in some
way or form package the dll up so that it would get delivered client side and
then have access to the printer port, but I am having a heck of a time trying
to track down any info/articles on how to do this.

Basically, the procedure needs to go as follows:

1. Client fills out a form for shipment information and clicks a submit
button.
2. Code behind handles the click event, transmitting the label request to a
3rd party and receiving back the binary data for the label, then sending that
binary data directly to a selected printer (by calling a static method in the
class library dll that handles the delivery to the printer).

If someone could just point me in the right direction of where to find info
on how to accomplish this it would be most appriciated!
 
Y

Yuan Ren[MSFT]

Hi,

Thanks for posting!

Based on my understanding, the current issue is that the ActiveX control
handles the data from the ASP.NET and sends it to the client printer. If I
have anything misunderstanding, please let me know.

From your description, the data submitted from the client can be deal with
the ASP.NET application. After the manipulation, we can use the
Response.BinaryWrite method to send the binary data to the client. Then, we
use the ActiveX control to print.
"2. generate a pdf file and send it back to the client, then the end user
could print the pdf file directly."
As far as I know, this is a common way to implement the current
requirement. There are many samples from third party. Please reference
these.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

Currently I do not have an ActiveX control implemented to push the data to
the client's printer. That is the component I am looking to build. I need to
be able to send the binary data directly to the printer, I can't reconstruct
it into a different format (like a pdf). I have a Windows Forms application
that also handles the label printing but of course that app has access to the
client's hardware. What I am in need of is a web based version of this.

I will take a look at the Response.BinaryWrite method and see if using that
and calling the window.print will work for me. Will a call to print this
actually get the binary data to the printer or will it just print a full page
with the binary data in text form? Also, if someone could please post some
links to articles on how I would go about creating an ActiveX solution using
C# and ASP.NET that would be much appriciated. My assumption is that my class
library that communicates and sends the data to the printer would have to run
Hi,

Thanks for posting!

Based on my understanding, the current issue is that the ActiveX control
handles the data from the ASP.NET and sends it to the client printer. If I
have anything misunderstanding, please let me know.

From your description, the data submitted from the client can be deal with
the ASP.NET application. After the manipulation, we can use the
Response.BinaryWrite method to send the binary data to the client. Then, we
use the ActiveX control to print.
"2. generate a pdf file and send it back to the client, then the end user
could print the pdf file directly."
As far as I know, this is a common way to implement the current
requirement. There are many samples from third party. Please reference
these.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
E

Edwin Knoppert

Print to pdf:

http://www.hellobasic.com/cgi-bin/forum/YaBB.pl?board=dotnet;action=display;num=1134897582


Schwarty said:
Currently I do not have an ActiveX control implemented to push the data to
the client's printer. That is the component I am looking to build. I need
to
be able to send the binary data directly to the printer, I can't
reconstruct
it into a different format (like a pdf). I have a Windows Forms
application
that also handles the label printing but of course that app has access to
the
client's hardware. What I am in need of is a web based version of this.

I will take a look at the Response.BinaryWrite method and see if using
that
and calling the window.print will work for me. Will a call to print this
actually get the binary data to the printer or will it just print a full
page
with the binary data in text form? Also, if someone could please post some
links to articles on how I would go about creating an ActiveX solution
using
C# and ASP.NET that would be much appriciated. My assumption is that my
class
library that communicates and sends the data to the printer would have to
run
on the client's machine so I would need to know how to deliver that and
how
to then access that from the code behind on the web site.


"Yuan Ren[MSFT]" said:
Hi,

Thanks for posting!

Based on my understanding, the current issue is that the ActiveX control
handles the data from the ASP.NET and sends it to the client printer. If
I
have anything misunderstanding, please let me know.

From your description, the data submitted from the client can be deal
with
the ASP.NET application. After the manipulation, we can use the
Response.BinaryWrite method to send the binary data to the client. Then,
we
use the ActiveX control to print.
"2. generate a pdf file and send it back to the client, then the end
user
could print the pdf file directly."
As far as I know, this is a common way to implement the current
requirement. There are many samples from third party. Please reference
these.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Y

Yuan Ren[MSFT]

Hi,

Thanks for your reply!
"Will a call to print this actually get the binary data to the printer or
will it just print a full page with the binary data in text form?"

As far as I know, it will print a full page with the binary data.
"if someone could please post some links to articles on how I would go
about creating an ActiveX solution using C# and ASP.NET that would be much
appriciated."

I think the ActiveX is only created by the unmanaged code. If you need this
control, I think there are many articles or solutions from third party.
Otherwise, you can post a new thread to the related newsgroup to get more
information. Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top