asp.net screenshot - c#

I need to work on a new feature where a user can make a screenshot of the content in the browser via asp.net page and save it automatically as jpeg. Is there a example or someone can give me some idea how I can do that?
I will really appreciate.
Thanks in advance, Lazile

The long and short of it is that you'll need to render the page on the server and take a picture of it. Depending on your format needs, there are a variety of ways to do this.
Here's a link to a tutorial for getting a snapshot in jpg, bmp, png, etc.
If you need to get it to pdf format, I would recommend either using a program like wkhtmltopdf, or using the information from the tutorial and then pasting that image into a pdf.

check this out. It's javascript on the client side. It might meet your needs with some tweaking.
Edit: caveat is that it doesn't work in <IE9 as it uses HTML 5 canvas.

Related

Best way to display pdf document in asp.net application

I'm looking for the best way to display pdf document on a website. Surely I need to convert it to jpeg or gif for the browser to handle it. I read few posts but most refer to GhostScript and its pdf2image. But that solution calls for starting a process that would save a copy of pdf doc to the file system and then would have to be loaded back into memory for displaying. Frankly I find it a bit clumsy. For those of you who have done it, what library you used and if you could attach a link to some examples, I'd greatly appreciate it.
I'm developick a web application that helps manage manufacturing process and is accessed fron android tablets. Company has a stockpile of documentation in pdf files that is to be delivered to production managers. I'd love the solution to be akin Crystal Report Viewer contron but I I understand that I have to stick to pdf to image conversion. Please give me some advise here.
My advice is don't over think this.
You can simply add a link to the PDF file, which will open on a new tab.
You can take a look at http://mozilla.github.io/pdf.js/ which will allow you to render a PDF on the client side.
Or if you decide to go with a Ghostscript, you can take a look at http://ghostscriptnet.codeplex.com
By all accounts the PDF Focus .NET library seems to be the best solution. A wrd of advice is to add a cleanup method to the page unload to delete all temporary files that were used to feed source into image controls when displaying pictures on a website.

Removable Images in PDF

I'm writing a ASP.NET program that inserts PNG images into a PDF. Ideally, I'd like to give users the option to undo this action later on.
I'm currently using the PDFSharp library to add the images, which is working fine, but I can't find anyway to then remove them. I've looked into the annotation functionality a little bit, but as far as I can tell there's no way to use custom images.
Does anyone have any experience or insight into this issue? Thanks.
The PDF format is final presentation format not really designed for this kind of modifications, it is possible to do this with other libraries, but for your particular case I would recommend instead keeping a copy of the original file rather than trying to revert this kind of modifications.

Convert a div and contents inside it to image

I have a DIV container which has some text, background-image, image. I need to convert that whole DIV contents into image and save.
I have googled it around but could not find the perfect answer. some are giving answers that uses a windows application , but i need it on a web platform .
any help will be highly appreciated
From what I understood, you have to do that in the client side, so you should take a look at the toDataURL method of the canvas.
If you don't know, the canvas support text and image.
Example and little library at this link:
http://www.nihilogic.dk/labs/canvas2image/
http://html2canvas.hertzen.com/
Does't support IE though. Looks solid other than that.
This is possible, with modification to the code here http://html2canvas.hertzen.com/screenshots.html you could perform the required screenshot :)

How to create edit thumbnail feature as in facebook(while uploading display image) in Asp.net using c#?

I want to upload an image and want to show a particular part of image in the thumbnail of particular size. I want to customize the thumbnail look.
I think it is a combination of an ASPX page, some jQuery plugin like Image Crop (http://www.webresourcesdepot.com/jquery-image-crop-plugin-jcrop/) and a handler which accepts the changes made to the image using an AJAX call.
I think it would be pretty easy as long as the jQuery plugin supports the right events. Jcrop supports an onChange event, which you could use to send certain coordinates to a handler.
Edit: Someone already did this and wrote about it: http://www.omerfarukzorlu.com/post/ASPNET-Image-Croper-Component-with-JCrop.aspx
PS. Not sure about the downvoting. It is a new user, but StackOverflow does not supply complete solutions for most cases, but just tips and pointers to find the solution yourself.

Wanted: ASP.NET control to view/print PDF, TIFF, possibly more?

I'm looking for an asp.NET control that will allow for viewing and printing of a pdf and TIFF within a web form. I'm willing to use more than 1 control if needed (1 control for pdf, 1 for Tiff, show and hide based on file extension), but I have not been able to find a good Tiff viewer.
Files are stored on our LAN in a shared folder, and this application is an intranet site.
Open source / free licensing preferred, but I'm willing to look at paid options as well.
http://www.alternatiff.com/ is one of the viewers that I've seen used for this type of viewing of tiffs.
You can get a free licence of ABCPDF (provided you link back to their site) which will do the conversion from TIFF to PDF for you as per #Chris Lively 's suggestion.
It'll also do conversion from PDF to TIFF if you decide to do things backwards.
It makes sense to present the content in a common format. If you wanted to you can embed the PDF in the browser to create the 'seamless' experience you're looking for using something like PDFObject.
As #BenCr says though, PDF is a really common format and the tools already exist to open and work with them, so introducing new ways to perform existing tasks could actually end up complicating matters unnecessarily.
I'm in total agreement with #BenCr on this.
Viewing PDFs is an extremely common thing to do. This isn't a "technical" issue by any stretch.
It sounds like you have some type of faxing solution in place that is creating these documents. Most likely multi-page TIFF and PDFs.
If this is the case you might want to just convert the TIFFs to PDFs to begin with and run everything through Adobe's pdf reader. Every online fax solution does this.
You could try http://issuu.com/ and they appear to have a API too if you want to go that deep.
We used the the Seadragon control to do this. I think it was an overkill and we should have just rolled our own -- would have been cheaper than integrating it. TIFFs and PDFs are converted to PNG on the server side. I don't think you can do better than that, especially with PDFs (assuming you don't want to use Acrobat Reader to display them). Convert PDFs to PNG using Xpdf/Poppler.
How about using Google Docs Viewer?
EDIT: Probably not working, since the viewer has to read the document from your URL; when it's on the Intranet, this won't work.
If you can mess about with mime types -- mainly by making the .tiff files expose an application/pdf mimetype -- you should be able to get acrobat to open TIFF files directly by effectively fooling the browser to open TIFF files with acrobat. Then all you need is a trusty old iframe to get you familiar UI with print buttons.

Categories

Resources