vb.net - Print Text to Printer Ignoring Page Length Using VB -


my task this:

i need print string printer formatted appropriately using third party program, planetpress. have decided use xml format better manipulation. problem when send string printer, appears abide normal page width , height restrictions , cuts off additional characters , lines. need able print text file, no matter length, , not have manipulated in way. here code printing:

imports microsoft.visualbasic imports system.drawing imports system.drawing.printing  public class print     friend texttobeprinted string      public sub print(byval text string, byval printer string)         texttobeprinted = text         dim print new printing.printdocument         using (print)             print.printersettings.printername = printer             addhandler print.printpage, addressof me.printpagehandler             print.print()         end using     end sub      private sub printpagehandler(byval sender object, byval args printing.printpageeventargs)         dim myfont new font("courier new", 9)         args.graphics.drawstring(texttobeprinted, new font(myfont, fontstyle.regular), brushes.black, 0, 0)     end sub end class 

and here call it:

    protected sub btnprint_click(byval sender object, byval e system.eventargs) handles btnprint.click      dim printer new print     printer.print(trim(strprint), "\\nj-nt-ppress\capture") 

and here create string print. it's using iteration through objects collection member , strprint defined global variable:

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load     dim oj new clsjobs, ojm clsjobs     if not oj.readallactivejobs         ' manage error     else         dim tr tablerow, tc tablecell, chk checkbox         strprint = "<?xml version='1.0' encoding='utf-8'?>" & environment.newline         strprint = strprint & "<jobschedule>"         strprint = "<timestamp>'" & now.tostring & "'</timestamp>"         hdnscrollspeed.value = oj.mcollection.count         each ojm in oj.mcollection             strprint = strprint & "<job>"             tr = new tablerow             tc = new tablecell             tc.text = ojm.jobid             tc.visible = false             tr.cells.add(tc)             tc = new tablecell             tc.text = ojm.jobpriority             tc.font.bold = true             tc.cssclass() = "priority"             strprint = strprint & "<priority>'" & ojm.jobpriority & "'</priority>"             tr.cells.add(tc)             tc = new tablecell             tc.text = ojm.jobnumber             tc.cssclass() = "jobnumber"             tr.cells.add(tc)             strprint = strprint & "<jobnumber>'" & ojm.jobnumber & "'</jobnumber>"             tc = new tablecell             tc.text = ojm.itemnumber             tc.cssclass() = "itemnumber"             tr.cells.add(tc)             strprint = strprint & "<itemnumber>'" & ojm.itemnumber & "'</itemnumber>"             tc = new tablecell             tc.text = ojm.moitem.description             tc.cssclass() = "itemdescription"             tr.cells.add(tc)             strprint = strprint & "<itemdescription>'" & sharedcode.stripcommas(ojm.moitem.description) & "'</itemdescription>"             tc = new tablecell             tc.text = ojm.momold.moldnumber             tc.cssclass() = "mold"             tr.cells.add(tc)             'tc = new tablecell             'tc.text = ojm.moinsert.insertletter             'tc.cssclass() = "insert"             'tr.cells.add(tc)             strprint = strprint & "<mold>'" & ojm.momold.moldnumber & "'</mold>"             tc = new tablecell             tc.text = ojm.quantity             tc.cssclass() = "quantity"             tr.cells.add(tc)             strprint = strprint & "<quantity>'" & ojm.quantity & "'</quantity>"             tc = new tablecell             tc.text = ojm.momachine.machinenumber             tc.cssclass() = "machine"             tr.cells.add(tc)             strprint = strprint & "<machine>'" & ojm.momachine.machinenumber & "'</machine>"             tc = new tablecell             'chk = new checkbox             'chk.checked = ojm.isrunning             'chk.enabled = false             'tc.controls.add(chk)             if ojm.isrunning                 tc.text = "<img src='img/running.png' />"             end if             tc.cssclass() = "running"             tr.cells.add(tc)             strprint = strprint & "<running>'" & ojm.isrunning & "'</running></job>"             tblmstrjobslist.rows.add(tr)         next         strprint = strprint & "</jobschedule>"     end if     exit sub end sub 

i post screenshots of text file output not have enough reputation. have looked @ string in debug , has correct information. once sent printer when lose data. appreciated. thank you.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -