Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi !

I want to Convert a part of .aspx page into PDF File from a Button.

Please give the solution.


Sir, I am using a JavaScript Function to Print a Part of Page from a Button. Similarly I want to Convert same thing into PDF instead of Print from another Button either from JavaScript or any other process.Presently I have not tried any code. 


To print the Function is:

function printPartOfPage(elementId)
 { var printContent = document.getElementById(elementId); var windowUrl = 'about:blank'; var uniqueName = new Date(); var windowName = 'Print' + uniqueName.getTime(); var printWindow = window.open(windowUrl, windowName, 'left=50,top=0,width=750,height=950'); printWindow.document.write(printContent.innerHTML); printWindow.document.close(); printWindow.focus(); printWindow.print(); printWindow.close();
 }
Posted
Updated 1-May-12 2:21am
v4
Comments
LebneizTech 1-May-12 7:24am    
I am using to Print a Part of Page from JavaScript, the Function is :
function printPartOfPage(elementId)
{
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName,
'left=50,top=0,width=750,height=950');

printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}

First of all you've posted an incomplete question: you should have posted what you've tried, where are you stuck...

Apart of that, you can always get the PDFCreator source code in order to see how do a PDF printer works and use then the recommendation from LebneizTech to print the part of the page you are interested in.

Good luck.
 
Share this answer
 
Comments
Joan M 1-May-12 8:03am    
I've not seen that you were the same user that posted the comment... update/improve your question with the comment it will lure more CPians to answer your question... :thumbsup:
Hi ,
Check this article Here[^]
Best Regards
M.Mitwalli
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900