vb.net - How to print contents of iTextBox (Visual Basic) -


i have software created me, when hit print button gives option save pdf. how can open print dialog box , print there.

this have now:

 private sub button4_click(sender object, e eventargs) handles button4.click         sfd.filter = "pdf file|*.pdf"         sfd.title = "save pdf"         sfd.showdialog()         if sfd.filename <> ""               dim mydocument new itextsharp.text.document(pagesize.letter)             try                 ' step 2:                 ' create writer listens doucment , writes document desired stream.                  pdfwriter.getinstance(mydocument, new filestream(sfd.filename, filemode.create))                  ' step 3:  open document using                 mydocument.open()                  ' step 4: add contents document                 mydocument.add(new itextsharp.text.paragraph(rtpreview.text))             catch de documentexception                 console.[error].writeline(de.message)             catch ioe ioexception                 console.[error].writeline(ioe.message)             end try             ' step 5: remember close documnet             mydocument.close()              process.start(sfd.filename)         end if      end sub 

i found online , opens print dialog box , allows send printer prints blank page. can't figure out how have print contents of rich text box?

private sub button1_click(sender object, e eventargs) handles button1.click    printdialog1.document = printdocument1    printdialog1.printersettings = printdocument1.printersettings    printdialog1.allowsomepages = true    if printdialog1.showdialog = dialogresult.ok       printdocument1.printersettings = printdialog1.printersettings       printdocument1.print()    end if end sub 

any ideas of needs done? tried playing around cannot find solution. thanks.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -