|
Hello,
In our project, we have a requirement to export a web page (Asp.Net) to PDF file. All the controls on the page (The web page completely along with its format) should be exported to PDF file. Anybody has worked on this before?
Can you please shed some light on this to get it work?
As we have some constraints, we have to do it without spending money.
Thank you in Advance,
Raheem MA
|
|
|
|
|
|
Anurag,
Thank you for your reply.
I did go through the links you provided. First one, AltSoft might match our requirement but it is not free of cost. Second One, just creates PDF files in Asp.net but does not export the asp.net page to PDF.
Our requirement is exporting the complete Asp.net page (.aspx) to PDF file.
Can you please provide any other information regarding this.
Thank you in Advance,
Raheem MA
|
|
|
|
|
|
Hi Raheem
The procedure is
step1:render the page through asp.net code in a web browser, this will return a bitmap
public System.Drawing.Bitmap CaptureWebPage(string URL)
{
// create a hidden web browser, which will navigate to the page
System.Windows.Forms.WebBrowser web = new System.Windows.Forms.WebBrowser();
web.ScrollBarsEnabled = false; // we don't want scrollbars on our image
web.ScriptErrorsSuppressed = true; // don't let any errors shine through
web.Navigate(URL); // let's load up that page!
// wait until the page is fully loaded
while (web.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete)
System.Windows.Forms.Application.DoEvents();
System.Threading.Thread.Sleep(1500); // allow time for page scripts to update
// the appearance of the page
// set the size of our web browser to be the same size as the page
int width = web.Document.Body.ScrollRectangle.Width;
int height = web.Document.Body.ScrollRectangle.Height;
web.Width = width;
web.Height = height;
// a bitmap that we will draw to
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height);
// draw the web browser to the bitmap
web.DrawToBitmap(bmp, new System.Drawing.Rectangle(0, 0, width, height));
return bmp; // return the bitmap for processing
}
Step 2: and then save this as PDF
|
|
|
|
|
Thank you Deepika for your response,
But I dont want to capture the complete webpage. Following is the scenario:
We have "Export" button on every webpage(contains Charts, graphs etc...). On Export button click, the charts , graphs ... of the particular page should be exported to PDF file.
Any ideas ?
Thank you in Advance,
Raheem MA
|
|
|
|
|
Hi Raheem
You need to create one page named preview and render only those things which u need to export on that page (if it is a chart then only render chart on that page) and then try that code.
at the time of export just redirect to the export page(another page which will run the bitmap and web browser code) which will do the stuff for you and then call the preview page in url then it will export only charts etc.
Thanks
Deepika
|
|
|
|
|
Hello Friends,
My requirement is we will have many Asp.Net server controls on a webpage and a export button. On clicking Export button, all the content & asp.net controls should be exported to PDF file.
Please help me, this is urgent.
Thank you in Advance,
Raheem MA
|
|
|
|
|
Hello Experts
I've this Gridview of tasks a Hyperlink TemplateField that takes the user to another page where he can accept/reject[buttons] the very task , on clicking accept/reject[buttons] the page redirect the user again to the tasks Gridview , unfortunately , the same task is still there unless if the user manually Press F5[Refresh] I tried the following nothing worked
1- EnableViewState ="false"
2- In the ObjectDataSource , EnableCaching ="false"
3-i tried to use Ajax but it gives me a whole lots of errors from the webconfig ,my website is working ,I can’t stop users from accessing my site in order to wrestle with Ajax
what else that I can do?
One more question Experts,
the approach I am taking on developing my site is to work in my local machine when I am finished with my changes I literally Copy/Paste the new aspx/aspx.vb overwriting the old file with the new one , this approach is working fine but it causes the server to a bit slow esp. in the first time after change, is there a more Professional way?
Thanks in advance
|
|
|
|
|
Another Page is opening in PopUp ???
|
|
|
|
|
on hyperlink click it redirects the user to Another Page
|
|
|
|
|
hi all,
I use sql server 2005 and C#(asp.net) to build a library system (web site),
but my problem is..
i can insert a row into database at datetime format MM/dd/yyyy, but if my server date format changed to any format my web site is stop work and do an exception ..( the conversion of a char data type to a datetime data type resulted in an out-of-range datetime value).
can u help me please,,,
thanks all
|
|
|
|
|
Hi,
could you post the code how you are trying to insert the new row? I guess the sql-server is expecting a datetime-row and you try to store the date as string.
Regards
Sebastian
|
|
|
|
|
Try to Change the DateFormat to MM/dd/yyyy before inserting into database
Like this
DateTime.Today.ToString("dd-MMM-yyyy")
|
|
|
|
|
I have deployed a project in ftp location. It is a .net with mysql application.
But i am trying to open the site getting the execption like the following
"Unable to connect to any of the specified MySQL hosts.***********System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 174.143.28.30:3306 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) at MySql.Data.MySqlClient.NativeDriver.Open() "
But i could connect the remote mysql server from my local application.Its working fine at time..
If anybody knows why this occur,please replay .Thanks in advance
|
|
|
|
|
so this problem doesn't happen when you connect to the localhost but when you try from a other pc to connect to the server it doesn't work?
|
|
|
|
|
Hi i am new to CMS.
From where i can get CMS basics
|
|
|
|
|
Hi All,
How to clear session when i close the browser.
I have assigned the following value in session
Session["SessionId"] = sessionId;
Session["userId"] = userId;
I want to clear this value while user close Browser
Thanks and regards,
Amit Patel
|
|
|
|
|
Why do you require an extra server call to clear session..
Rather you can use Session Timeout easily which is automatically called.
|
|
|
|
|
Hi
I want to implement functionality where user can login from one system only if he logs in from other machine then he should logged out from another machine so for this we implemented forced logout
for this i created on dictionary in App code in global which contains user id and corrospoding session id
but when i closing my browser it is not getting removed
so when i m logging from same machine it is also iving forced logout is session is not expired
so i dont want to show this message
Thanks
amit
|
|
|
|
|
For that you have to capture the browser close event from javascript and if it is browser close then open a new page remove the session from server side of that page then close that page.I have impleneted in this way.The sample code is :
Javscript code to capture the browser close event and accordingly open the new page to remove the session
function CloseSession() {
if(window.event.clientX < 0 && window.event.clientY <0)
{
window.open("CloseSession.aspx", "OpenWindow_Close_Session",'left=12000,top=1200,width=10,height=1');
}
}
Call this method on unload of your master Body .
onunload="DeleteUserLog()"
Now in CloseSession.aspx pages, you can do what ever you want and register the client script to close it automatically after doing the task.
Hope it'll help you.
Cheers!!
Brij
|
|
|
|
|
|
add Session["user"]=user;
clear Session.Remove("user");
modified 27-May-14 4:55am.
|
|
|
|
|
hi,
in my application i am using asp:menu control. when there is large amount of data on a page the menu control starts working slow.
when i added
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE6" />
tag on the master page before doctype the menu started working properly, but the menu stylesheet changed. in the stylesheet i had to add a html td tag eg:
td
{
font-size:12px;
font-weight:bold;
font-family:Arial, Helvetica, sans-serif;
margin-left:5pt;
line-height:15pt;
}
this solved the stylesheet issue.
I want to know why i have to add <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE6" /> for making the menu control fast and why i have to add td tag in stylesheet.
Thanks
Sandeep Kumbhar
|
|
|
|
|
Hi,
I developed one reporting service application from VS - File - new Project - Bussiness intelegence projects - report server project wizard from visual studio 2.0, The report is working fine and i hosted in a virtual directiory also. now am trying to deploy the application its showing error like , A connection could not be made to the reporting server http://localhost/reportserver. So how to overcome this problem can you anyone please give me a right solution.
Thanks in Advance,
kannak....
kannak
|
|
|
|