473,395 Members | 1,689 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,395 software developers and data experts.

Streaming optimatization needed

Hi !

I'm working with a lot of different labelprinters. Some of them are quite picky about how they
receive data. Especially one of them needs to receive one graphic file at a time.

In this case, I've made special files for each graphic containing instruction for the labelprinter
along with the graphic in binary format. These files are stored as embedded resources in a library
that I made (DLL). It works well, but I suspect that there must be smarter ways to do this in order
to speed up the transfer.

Part of the code follows below. Any suggestions are greatly appreciated !

TIA
Kai Bohli
Norway

<snip>
public void TransferGraphicsToLabelPrinter(string NameOfPrinter)
{
using (Stream input = Assembly.GetExecutingAssembly().GetManifestResourc eStream(
"ProTeria.Transport.LabelPrintLib.Grafikk.Zebra284 4.betalning.txt") )
{
long length = input.Length;
WriteMemoryStreamToPort(input,length,NameOfPrinter );
}
using (Stream input = Assembly.GetExecutingAssembly().GetManifestResourc eStream(
"ProTeria.Transport.LabelPrintLib.Grafikk.Zebra284 4.vekt1.txt") )
{
long length = input.Length;
WriteMemoryStreamToPort(input,length,NameOfPrinter );
}
....
....
and so on
....
....
/// <summary>
/// WriteMemoryStreamToPort
/// Purpose: Writes the stream directly to the printerport. Use for Graphics only
/// </summary>
/// <param name="input"></param>
/// <param name="length"></param>
private void WriteMemoryStreamToPort(Stream input, long length, string nameOfPrinter)
{
using (MemoryStream output = new MemoryStream())
{
byte[] buffer = new byte[length];
int read;

while ( (read=input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
output.Flush();
output.Position = 0;
LabelPrintHelper.SendDocToPrinter(nameOfPrinter,ou tput);
}
}
</snip>
Best wishes
Kai Bohli
ka***********@online.no
Norway
Nov 16 '05 #1
0 968

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

Similar topics

22
by: googlegroups | last post by:
I am playing with the XMLHTTPRequest method to perform client/server transactions. I have it set up right now so that when readyState is 4, it takes the XML and processes it. This works great until...
5
by: John | last post by:
Hi all, I have an (well, what I think to be, at least) interesting question: Is it possible to stream data down to the client and, after a certain amount of data has been streamed, allow the...
3
by: A.M-SG | last post by:
Hi, I have a ASP.NET aspx file that needs to pass large images from a network storage to client browser. The requirement is that users cannot have access to the network share. The aspx file...
2
by: mpaliath | last post by:
Hi guys I am currently involved in a project which requires me to recieve and play streaming video as well as send it. In Visual C++ is there any free library which helps me do this as...
1
by: adiela | last post by:
hello everyone..i would like to ask something regarding my project.. i've been planning to develop a website using asp code for streaming multimedia features...unfortunatly...i have zero...
8
by: Amjad | last post by:
Hi i am writing a application where i want to browse video file and copy data into stream and send that stream over network...I have develop P2P windows application where i successfully transfer...
2
by: SPG | last post by:
Hi, Two questions for you all.. Firstly, is there a way of streaming video using PHP? At the moment I just have a link to a video file and the whole thing downloads before playing which is a...
5
by: pmakoi | last post by:
dear all this might be a piece of cake for some of you out there but it is causing me a lot of stress given the fact that there is not enogh documentation out there regarding this topic I am...
1
by: Faisal Shafiq | last post by:
I want to upload a file direct to the Silverlight Streaming Service from a Web Client such as silverlight application. As per our product requirement we want to upload a .WMV file directly from...
11
by: Alexander Adam | last post by:
Hi there! I've got a few (more generic) questions for those C++ experts out there. 1. I am trying to store any kind of data (custom PODs, numbers, strings etc.) within some kind of stream...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.