Slightly different problem than one being discussed above but I think
fits under the heading.
I am using a slight variation of Andre Feller's Print class for
printing EPL text codes to a printer. Here is the code:
<code>
public static native void printTextPlain(String html) /*-{
var frame = $doc.getElementById('__printingFrame');
if (!frame) {
$wnd.alert("Error: Can't find printing frame.");
return;
}
frame = frame.contentWindow;
var doc = frame.document;
doc.open('text/plain', 'replace');
doc.write(html);
doc.close();
for (var cii=0; cii < 100000; cii++){}
frame = $doc.getElementById('__printingFrame');
frame = frame.contentWindow;
frame.focus();
frame.print();
}-*/;
</code>
What I Am Printing:
I am sending a text string containing EPL codes for printing barcodes.
Example shown below:
Code starts below -- This line not for printing
N
A100,0,0,1,1,1,N,"Line 1"
A100,20,0,1,1,1,N,"Line2"
b100,30,D,h5,"Line3"
P1
Code ends above -- This line not for printing
How:
Server generates the EPL codes shown above and sends it back to the
browser.
I receive the string (as plain text using US-ASCII character set) and
pass it on the printing function shown above. As you can see the text
string includes CRLF characters or \n characters.
The Problem:
What is supposed to happen is that the printer (specific brand is
ZEBRA) interprets the codes and prints a combination of text and
barcodes. If I copy the above codes into a text editor (e.g. notepad)
and hit print, the barcodes are printed just fine.
If I send the above string to a printer that does not know how to
interpret the EPL, it prints the plan text as seen, which is what I
expect.
If however I send the same string above to the ZEBRA printer using the
printing function and a hidden frame, nothing is printed and the
printer does not respond. To me this is an indication that the browser
is adding addtional characters to the string that causes
the printer to be unable to interpret the codes as EPL and so it does
not print.
***Note that I make certain to make open the DOM document as text/
plain so that it does not interpret the text as html.
Also when I send the text string from the server, I set the content
type to "text/plain;charset=us-ascii");
What I don't know is whether the new document I open uses the same
charset set in the server response header?
I also dont know (nor do I know how to check) whether additional
characters are being added to the text string by the browser before
submitting the print job to the printer. I think it is adding addition
characters since if I copy the string into a text editor, everything
works just fine.
Any ideas.
Thanks,
Melody
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---