Tag: print

Print..

Print to Default printer without showing Print Dlg.

Dim Psi As New ProcessStartInfo
Psi.UseShellExecute = True
Psi.Verb = “print”
Psi.WindowStyle = ProcessWindowStyle.Hidden
Psi.FileName = “C:\SimTemp\Test.txt”
Process.Start(Psi)

Print PDF file in VB.Net by giving Printer Name

Here is the solution of printing PDF file by giving printer name

Dim pathToExecutable As String = “AcroRd32.exe”

Dim sReport = “C:Test.PDF” ‘Complete name/path of PDF file

Dim SPrinter = “HP Officejet 5600 seriese” ‘Name Of printer

Dim starter As New ProcessStartInfo(pathToExecutable, “/t “ + sReport + ” “ + sPrinter + “”)

Dim Process As New Process()


JavaScript..Print contents in a DIV

PRINT WATEVER YOU WANT IN A DIV, ON A BUTTON CLICK.

Aaron says “Create a div around the content you want to print”.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

ButtonPrint.Attributes.Add(“onclick”, “javascript:CallPrint(‘divPrint’);”)
end sub

<script language=”javascript”>
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var strOldOne = prtContent.innerHTML;
var WinPrint = window.open(”, ”, ‘left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0′);
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML = strOldOne;
}
</script>

Strid should be the ID of the DIV.

Dont forget runat=”Server”


  • Cloud World

  • Custom Search



  • Cyberbrutus
    iDream theme by Templates Next | Powered by WordPress

    Switch to our mobile site