I am trying to build a character sheet for roll20. While I understand I can use other systems for this, I am trying to learn C# and I figured doing this using C# and Razor would be an interesting challenge.
However, to run on roll20, I need at most a js file, a css file, and an html file. I am trying to find a way to output to files in a specific directory. Is this at all possible and if so how would I do it? I'm trying to investigate this before wasting my time on something that isn't possible, and searching through the internet all describe using a server render, which is not possible with what I'm doing.
Any one tried implementing fast web view using PDFSharp in C#.Net.
Kindly let me know how it can be achieved.
Thanks in advance
PDFsharp does not (yet) support fast web view (which basically re-arranges elements in the PDF file so that partially downloaded PDF files can show the first page earlier).
PDFsharp has some options that allow to create smaller PDF files.
See this post in the PDFsharp forum:
http://forum.pdfsharp.net/viewtopic.php?p=9647#p9647
If you use the PDFsharp source code for your project, make sure you ship a RELEASE build (the DEBUG build creates much larger PDF files by default for debugging purposes).
The WebBrowser control has a method named ShowSaveAsDialog() which can save a loaded document into a file. I want to find out the path of the saved file and open it. How can I find such a path or an alternative way to save an html file loaded by WebBrowser control.
It seems you want to save everything to a web archive (.mht) file. I can't see that anyone has got that working via the WebBrowser control.
However, there are alternatives for doing this programatically. Jeff Atwood posted an article on CodeProject: Convert any URL to a MHTML archive using native .NET code but it's in VB.NET. Incidentally, Jeff is one of the co-founders of this site and is Stack Overflow Valued Associate #00001!
Someone has kindly ported Jeff's code to C# and that can be found on Google Code here: url2mhtml
Also see this question: generate .mht file programmatically
I am developing a ASP .NET MVC application where users are able to upload files to a repository. Those files could be pdf, doc, any type of image and so on.
When the user select a file to be imported I would like to display this file in the browser so they can review its contents before the upload.
I know I could use some sort of IFrame to display pdf but I am looking for some specific class or .net libraries to implement this feature.
I just need a north.
This is an extremely difficult problem. There are some libraries that can help. For instance PDF files might be rendered to images with ghostscript. Word and Excel files might be converted to PDF or image with a number of libraries. None of them, AFAIK, are very good at it so I can not recommend one.
You could automate MSO to perform the conversion to PDF, but that is decidedly not safe for server code. Another possibility is convert source documents to SWF files (like flexpaper) and display in flash. There are some great libraries out there, but it will limit your supported clients. Sharepoint has support for providing some of this capability as well. Others have used OpenOffice to convert MSO documents but also at a loss of quality.
I can't really advise any specific direction as it is highly dependent on what you/your company is willing to spend and the desired results. Good luck.
You could try to rely on Windows and the explorer thumbnails for it, like here, but then you'd have to make sure that:
You can abuse the server in the most elaborate way (install stuff, talk to the shell from ASP.NET)
You have a thumbnail provider installed on the server for every type that you want to preview. I guess from the moment you can see the thumbnail in explorer, you're set. So for pdf, you might need to install PDF Reader from Adobe.
Docx files should be saved with thumbnail checked (see link). There seems to be no other easy, free way to convert a docx to a thumbnail. The "best" solution I came across, was saving it automatically again somehow, and making sure the thumbnail option is checked.
I don't want to say that's impossible, but it can't be done with finite effort.
What you are asking for is a browser-based solution, because you want the user to be able to "review" the document before uploading.
Therefore you cannot use a server side solution, which is essentially what is being asked by referring to a ".Net library".
.Net libraries are dependent on an installed version of .Net, which does not exist in all versions for all operating systems for which graphical browsers exist.
Next, recent changes in browser security do not allow to read the full client-side file name of the selected file in the input field.
You'd have to rely on HTML5 and its FileReader to access the file's byte stream, but even then you can only retrieve image from image files. (see sample)
Excluding browser-based solutions in Flash, ActiveX, Java, due to browser and platform support, this leaves JavaScript as the only "reasonable" solution: you'd need a library for each supported format to either convert a file into an image in an image format supported by browsers, or extract the text(+image) representation of a file.
Great awnsers... Just want to share the result of my research and I found a nice client-based solution supported by Mozilla Labs. This is a framework based on HTML5 and Javascript with no native code needed.
Here the project website:
https://github.com/mozilla/pdf.js
This is what you are capable of:
http://mozilla.github.com/pdf.js/web/viewer.html
And for the last a great video explaning how everthing works
http://www.youtube.com/watch?v=Iv15UY-4Fg8&noredirect=1
Reguarding my question we are going to converter every possible file to PDF on the server and then render this PDF using this framework.
Hi i'm new programming and i have written few application to access pdf content by using some dll files, but now my question is how can we write our own dll to access the pdf files. I know it's a big process but i'm very much interested to learn about this. any one please help me.
You can start by reading the PDF specification (warning 32MB behind this link) in order to understand how the PDF file format is implemented. This is necessary if you want to be able to parse it and extract the information you are interested in.
In the meantime (as this reading might occupy you during a certain amount of time) if you have pressing project deadlines you probably want to use an existing library such as iTextSharp.
I know it's a big process but i'm very much interested to learn about this.
That's true. I'd like to suggest to study some open source APIs (iTextSharp) and PDF SDK.