Click here to Skip to main content
12,511,307 members (142,004 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I have created a PDF using Itextsharp in my asp.net application and i want to print it directely without downloading.Plz help......
Posted 11-Dec-12 0:46am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Try this ....call this js function on button click..
 
function PrintReport()
{
    var strHtml = '<html><head><title>Test Page to print</title></head><body><B>Test Page to print</B></body></html>'//Your Html code here;
    var printContent = strHtml;
    var windowUrl = 'about:blank';
    var uniqueName = new Date();
    var windowName = 'Print' + uniqueName.getTime();
    var printWindow = window.open(windowUrl, windowName);
    printWindow.document.write(
    '<link href="css/style.css" rel="stylesheet" type="text/css" />' +
    strHtml.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "") + '</div>'
    );
    $(printWindow.document).find('a').each(function () {
    $(this).attr("href", "");
    });
    printWindow.focus();
    printWindow.print();
}
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Have a look on this similar QA hope you get some help out:
Print PDF from ASP.Net without preview[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100