Question : I need to send a form feed to printer (VB.NET & ASP.NET)

Hi,

Using VB.NET I need to insert a form feed into the code below, I've tried:
   PrintLine(1, Chr(12)),

   Dim FormFeed As String
   FormFeed = Chr(12)
   PrintLine(1, FormFeed)
No luck though.




       PageNumber = PageNumber + 1
       Page = Right$(CStr(PageNumber), 1)

       ***FORM FEED SHOULD BE HERE***

       PrintLine(1)
       PrintLine(1, SPC(6), "NAME: " & Session("CurrentClient.Name"))
       PrintLine(1, TAB(41), "-", Page$, "-", TAB(62), "TEST REPORT")
       PrintLine(1)
       LineCount = 3

Help!

Thanx,
Mike

Answer : I need to send a form feed to printer (VB.NET & ASP.NET)

Summary:
  You just need to insert
where needed.

> this is the consensus
Many of those comments are plain wrong, or they're just opinion.  Little is factually true.  The existance of
makes most of it false.  webwoman implies that web designers should not control printing at all.  I think they should be reasonable and cautious when controlling printing.  We already know that you're messing with printing, so let's try to be reasonable and cautious.

> txtAlpha.Text = contents
I'm not sure why you're forcing the user to view the report within a textbox.  Generally speaking, I'd just show the report as an entire web page (as you eventually do when they click PRINT REPORT).

> function printPage()
I don't see where this is called.  I'm ignoring it.

> function printIt(str)
Nice.

> winId=window.open('','printwin','scrollbars=yes,resize=yes,width=720,height=1350');
> new window opens up (no scroll bar)
The first line indicates that the windows will have scrollbars when needed.  Scrollbars are needed when there is more text than will fit in the windows.  The window opens but has no scroll bar, which implies that you're seeing all there is to see. Page 1 + 10% Page 2 is all that there is.  Which is why only that part prints.

Next question is:  Why is that all that there is?
It comes from:  winId.document.write(str);
from:  function printIt(str)
from: PRINT REPORT
So specifically, it's:  document.getElementById('thediv').innerHTML

Would you please confirm that this returns only Page 1 + 10% Page 2, as I believe?  Let me know.
You can probably just add a button with an alert box which shows that content, or just the last 200 or so characters ... enough so you can determine exactly what the innerHTML is.

You can also verify by looking at the source of the printed page (browser menu View | Source) if you temporarily comment out the close statement: winId.close();

The existence of the winId.close(); statement suddenly makes me think a couple things.  Is is possible the window's closing before the printing is completed, therefore truncating the output?

> However, not visible at this point. It is visible ... ???
 ... when the user scrolls the web page?  But you said there's no scrollbars.  What am I missing?

>           Dim myFile As String = Server.MapPath("REPORT.txt")
>           Dim objStreamReader As StreamReader
>           objStreamReader = File.OpenText(myFile)
>           Dim contents As String = objStreamReader.ReadToEnd
>           txtAlpha.Text = contents
>           objStreamReader.Close()

Because of the way that you loaded the text, I'm assuming it's just plain text, perhaps with some embedded tags, but does not have and tags..
You can pre-process it, right here.

> winId=window.open('','printwin','scrollbars=yes,resize=yes,width=720,height=1350');
  // *** RIGHT HERE, AT THIS POINT. ***  <===<<<
> winId.document.write(str);
> winId.document.close();
> winId.focus();
> winId.print();
> winId.close();

You could do things like:
  Insert a
wherever you want.  (Every 50 lines +/- some.)
  Add stuff before and after.  Here's one possibility.
  str = "
"
          + str
          + "
Copyright 2003, MyCo, Inc.";
 
(Pardon any typos or errors in my hand-coding.)

Does that help any more?
Random Solutions  
 
programming4us programming4us