Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
Schadrach
Newbie


Joined: 07 Dec 2004
Posts: 8

PostPosted: Tue Dec 07, 2004 6:48 pm   

Printing text verbatim.
 
I've noticed your documentation for zApp is a little incomplete, and I have a question about how to do something inside zApp.

I need to pull down some data from a webpage (got this part working) and on user command send it to a printer.

It has to go to the printer in exactly the form it came from the server in. No extra spaces, no extra formatting of any kind. It is data that goes to a piece of hardware. I tried loading it into a memo and using _MemoPrint, but it looks like most of the lines end up with some sort of indent...
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Dec 07, 2004 11:45 pm   
 
Hmm, that's going to be very tricky actually. Because you *don't* actually want the data to go straight from the web page to the printer....otherwise you would get all of the HTML tags on the printer. What you probably want is for the page to look the same as it does in a *web browser*.

The Memo component in zApp, while it supports HTML, is not a full web browser and will certainly not look the same as Internet Explorer.

About the only way I can see to do this is to use the ACTIVEX tag to load a copy of Internet Explorer (Shell.Explorer) like I do in the Web Browser demo application. Then, look at the Microsoft documentation for their WebBrowser component and find the method used to print the page. There should be one, since it's a very complete web browser object. But I have no idea what the syntax is.

Now, if you are looking at printing the text directly and not trying to render the HTML, then the Memo component should work fine. Make sure you use the Text property to set the Memo component. Then, take a look in the documentation for the zMemo component and look at the various "Margin" properties for setting the spacing around it when printed.

You might not have full scripting control over all of the Memo properties yet. The Memo editor supports the concept of "Text styles", and more related "Paragraph styles". The Paragraph styles control stuff like the line spacing, line indents, tab stops, etc. You can control all of this from a user interface (see the Editor demo program), but I don't yet have all of the scripting code set up to manipulate the text and paragraph styles from a script yet. But that is planned before the public release.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Dec 07, 2004 11:46 pm   
 
Oh, and yes, the documentation still has a long ways to go. There is a *lot* to write. But I'm working on it (or will be when I get back from holiday vacation Wink )
Reply with quote
Schadrach
Newbie


Joined: 07 Dec 2004
Posts: 8

PostPosted: Wed Dec 08, 2004 1:11 pm   
 
No, I actually want the text to go to the printer in exactly the form it is on the webpage. I'm making an HTTP request to get what is essentially a dynamically generated, formatted text file from the server, and this text is what needs to go to the printer unmodified.

I tried simply loading the result of the request into a memo control, and having a button with action="_MemoPrint". The data that appeared in the memo control is correct, but when I sent it to the printer, it came out wrong.

It looks like some extra spaces got placed in front of most of the lines, which is throwing the machine off. I'm printing to a tag machine, a metal embosser. It's treated as a "Generic/Text Only" printer in windows. The extra spaces are pushing the tag data to the right, which there isn't room on the tag to do so.

I'll try changing the margins and see if it helps...

UPDATE:

I've set all of the margins to 0, and it still hasn't helped. Here's the data from the webpage (and the data that displays in the memo box when I retrieve it):

Code:

<]01Y425X472 Y55X50F0 Y110X50F0 Y165X50F0 Y220X50F0 Y55X250F0 Y275X50F0  Y330X50F0 Y330X250F0 Y275X250F0 Y385X50F0  Y385X330F0>

<04XTEST
XXXX-XX-XXXX
XXXXXXX-X R.X
XXXXXXX
XXXX
XXX/XXXXX
H-XXXX
SL-XXX
DES XX/XXX
BLACK DOTTED
XXX>


And here's what gets printed to a generic/text only printer in windows:
Code:





                                        - 1 -

       <]01Y425X472 Y55X50F0 Y110X50F0 Y165X50F0 Y220X50F0 Y55X250F0
       Y275X50F0  Y330X50F0 Y330X250F0 Y275X250F0 Y385X50F0  Y385X330F0>
       <04XTEST
       XXXX-XX-XXXX
       XXXXXXX-X R.X
       XXXXXXX
       XXXX
       XXX/XXXXX
       H-XXXX
       SL-XXX
       DES XX/XXX
       BLACK DOTTED
       XXX>



















































It interprets this text with "<" denoting the beginning of a tag, each line denoting a field, and ">" denoting the end of a tag. What's causing the tag printer a problem is all the extra space in front of each line. The extra spaces cause all lines after the first in a tag to be output wrong, becuase they get interpreted as literal spaces and move the data over.

Is there a way to get it to print the data as it is displayed in the first code block rather than the second, or at least to drop the initial spaces in front of each line (the machine should be able to handle the rest of that). Is there perhaps another control that would make more sense to use?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Dec 08, 2004 5:50 pm   
 
Since the _MemoPrint is part of the 3rd party RichView component (MEMO component), I'd have to look more closely to see what it's doing. It's likely adding stuff itself...it's not a direct connection to the printer and it makes sense that it would add stuff like page numbers and margins.

It sounds like you need a lower-level printer access. I'll be able to add this to zApp in one of the next versions, but until then, check out some of the Windows system COM objects, like the CDO file objects and see if there is a way to open the printer device as a file that you can then just write to.

Do a Google search for something like "Printing via ASP" or "Printing via VBScript". If you find an article on how to send data to a printer from an ASP page or VBScript script, then that same method should work within zApp.

That's about all I can think of for a quick answer. When I get back from vacation I'll look into this more.
Reply with quote
Schadrach
Newbie


Joined: 07 Dec 2004
Posts: 8

PostPosted: Wed Dec 08, 2004 8:06 pm   
 
All right, thank you for your answer. I've always known you to be good to your customers (I've had zMUD since 97 or 98, thinking about ordering zApp Pro, depending on what the IDE will be able to do).

I was hoping to get away with getting to use the pretty windows printer selection dialog and so on and have everything look like the user expects before printing (that and some user who needs the tag printer will manage to try printing to the wrong thing unless it has a pretty label) _MemoPrint made that so simple and straightforward. Oh, well, I'll have to find an alternate way to do it...
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net