I'm having issues with converting my Intranet Page to PDF file. I used 2 solutions which actually works, however with some issues.
Solution 1:
I used wkhtmltopdf.exe tool. I was able to make it work on my local machine.
However, when I deployed it to our Server, it stopped working until I notice that it's not working with intranet sites. When I tried extranet sites, it's working.
Solution 2:
I took an alternative solution by getting the HTML of that site, and let the wkhtmltopdf.exe tool to make it PDF which also works, however, the data on my page that I'm trying to convert to PDF is database driven. So all information including images was not supplied when it was converted to PDF.
Please help if there's a way to make the wkhtmltopdf.exe tool work in Intranet Sites(solution 1) or
how I can retrieve the whole page including data and images when converting it to PDF(solution 2)
Thank you very much!
it stopped working until I notice that it's not working with intranet sites.
That is not an exhaustive problem report. I have done it by rendering a view to a string and then converting that string to a pdf using wkhtmltopdf.
Rendering the view to a string: Render a view as a string
i did not include wkhtmltopdf direct, rather I used the tuespechkin nuget package: https://github.com/tuespetre/TuesPechkin
I would say to look at the permissions available. Intranet sites normally have different permission levels than a public facing site. It could be that the public facing sites have permissions that have been applied to the .exe such as the IIS_IUSR account to enable it to work with anonymous guest accounts, but lack the permissions needed in an intranet which often uses the domain user account of the logged in user to authenticate resources.
For whtmltopdf software to generate pdf on your intranet server, you need to have 2 files msvcp120.dll & msvrp120.dll in the same folder as wkhtmltopdf.exe file to running from server side. Hope this helps.
Related
Body
Hi guys. I'll be rather brief if I can so here goes.
I made this app in C# that goes onto my employee portal and automatically gets my shifts for me every 30 minutes my using a web browser control and then it reads the HTML data from that and generates a calendar for me and also provides automated alerts.
Issue
Problem is that this web browser uses IE (yeesh help me) and it doesn't work with all parts of the site. I have done some digging around on the site and I found where the ASP site gets the data from: An XML sheet somewhere on the server. I can access this XML sheet, but only if I'm logged in (please see the attached images for more information).
Current solution
So my question is this: How do I actually login to this area?
I could login using the webbrowser and then download the XML using that, but it's too slow and too old, so is there a way I can pass my credentials through?
The URL is like this "https://www.mycoles.com.au/api/rosters/nextweek" -- I don't see any thing like ?name=myname ?pass=mypassword... soo yea. (I'm a bit new).
Further details:
Application language: C#.
Current technology: Windows forms applications/ IE web browser control.
Site backend: Microsoft Sharepoint.
Anything I'm missing? Please ask..?
Attached content
Mycoles XML Logged in
Mycoles XML Access Denied
Update:
So after a while of searching and examining the site, I tried to access the data with a c# webbrowser and it didn't work. It said that it can't download the data, however chrome is able to. Odd. I'm not sure it is an XML file anymore, rather a request and I don't have enough knowledge to work with this, so pointers anyone? Check this site out https://www.mycoles.com.au/api/rosters/nextweek and tell me what you think it is please. Thanks in advance... :)
SharePoint supports different forms of authentication. Out of the box, Active Directory-based single sign-on is provided, and forms-based (username, password) authentication can be configured.
Typically, organizations use AD SSO for its simplicity. If, once you open your desktop browser and navigate to a SharePoint site, you don't have to enter any credentials and are just logged in, then it's most likely this case. This can be either Kerberos or NTLM. The HttpWebRequest class supports both these methods.
I have my files stored in Azure File System and here are the requirements -
User should be able to view the documents without downloading it to the local
This is working fine for pdf but not any other mime types
I tried setting Content-Type,Content-Disposition (in azure file properties but no luck) and also iframe.
User should be able to edit the doc online without downloading.
I don't think this is possible just with Azure and have to integrate with One Drive may be? Correct me if I am wrong?
I would really appreciate any inputs/thoughts.
Not sure if this is a viable option but using Storage Accounts in Azure, you can map these accounts as a network drives to any client machine. So they would be able to access these files via File Explorer.
This link covers the basic steps in setting it up.
Unfortunately for anyone who wishes to use this feature, they need to be on Windows 8 (or above) to be able to map a network drive successfully as it uses SMB3.
If this option is a no go I will delete the post.
So I have here a .NET C# web app that needs one page able to be viewed offline as a user could be off in the middle of 'whoop whoop' with no internet.
The order of events are:
User visits a form online
Store the webpage using HTML5 so they can visit it later offline
When online - the user then can submit the form to the database
I've been looking over HTML5 appcache however it seems to only reference physical .html or .php pages rather than storing pages which have been generated by 'Razor' .cshtml Views.
e.g. domain.com/path/view.
I haven't been able to find any relevant documentation for my problem either.
So is it possible to cache a .NET webapp ofline?
Although I have not tried it, and assuming your app uses ASP.NET MVC, this might help you:
Build an HTML5 Offline Application with Application Cache, Web Storage and ASP.NET MVC
It uses HTML5 Offline Web Application API (or HTML Application Cache). Note the comment on browser support.
The linked article shows a sample application, but I could not see a link to a downloadable source code. But one commenter appears to have recreated the project.
The appcache is what you need. Note that you specify the pages to be cached, but the browser never sees if the page is a static .html or generated via Razor. As long as the path you specify opens the right page, it will be cached.
I am developing an MVC5/EF6 web application hosted on Azure using Visual Studio 2013. I have just got to the portion of development whereby I need to create the reports. I was trying to use Microsoft.ReportViewer to achieve this and although it works perfectly locally it would appear that the WOW (WAWS) on a standard Azure website does not have/allow enough privileges to generate/return a PDF via a stream reader (http://social.msdn.microsoft.com/Forums/windowsazure/en-US/b4a6eb43-0013-435f-9d11-00ee26a8d017/report-viewer-error-on-export-pdf-or-excel-from-azure-web-sites?forum=windowsazurewebsitespreview). The suggestion from Microsoft was to convert the web site to a web role - I am prepared to do this however it seemed like a "no go" for most contributors - also I cant find any tutorials on the matter (I have posted a new question on this).
My question is, what are my options? SSRS is being deprecated so a server call is out, hand cranking a HTML page does not appeal. The closest I have found to a solution breaks the MVC pattern, but should work see here:
Rendering an RDLC report in HTML in ASP.NET MVC
Any help would be greatly appreciated!
Cheers
David
I ended up creating a web role to gain access to GDI+ and elevated WOWs rights, from there I was able to export directly to PDF which is just what I wanted. Not sure why so many other articles condemned this it seems to work perfectly and the cost differentiator does not seem too bad... yes it is more - however, experiments with the extra small VM has proved quite successful.
I am coming from Java and PHP world, so .net is a bit unknown to me. What i need to do is a simple one user login, and protect 2-3 pages in the same subfolder (ex. main site is at ./ and my new login should be just for these 2-3 files in ./home).
This is kind of simple admin, that in php i would have done it in less than 10 minutes :) and here is causing me all sorts of headaches. What i have ended now is i have made a simple Forms authentication, with the hardcoded username and pass, and i have protected the needed pages in web.config (all works great on my local server), but now when i uploaded it to the live server, with the web.config inside the ./home folder, i get an error that i haven't specified an application folder correctly in IIS (and i have no idea how to do this on live server, if i only have access on ftp). Then i tried updating the ./ web.config, so that points to login.aspx in ./home (using subfolders), that didn't work too because it wasn't protecting the pages it needed to protect.
Please help, and point me to right direction,
Thanks.
First of all you have to read about ASP.NET form authentication. This will serve your purposes. Take a look at tutorial on form authentication.