Preview generated PDF on page - c#

I'm generating a PDF document in code-behind using Winnovative's HTML to PDF converter, and I would like to preview the document in a container on the page.
This is for an intranet application and all of the end users have the latest version of Reader installed, so compatibility is not an issue. The preview should be fully featured too, with the ability to zoom in and out, print, save, email, etc.
I've seen quite a few examples searching online, but I would appreciate some suggestions based on actual experience. Ideally, it would be great to find a server control with configurable options that can create the element(s) and register the necessary client scripts.

I think you just need the <embed> Tag. Put something like this in you page and you can show the users the PDF in the webpage itself.
<h3>Sample Pdf</h3>
<embed width="80%" height="80%" name="plugin" src="http://www.education.gov.yk.ca/pdf/pdf-test.pdf" type="application/pdf">
You will get all the features of Adobe Reader. Since its an Intranet app you should be able to Make sure Required Plugins are already installed on Client Machines.

Related

Picture Preview with input type "file" that works in all versions of IE (8 and up), using WebMatrix (C#) and/or JavaScript/jQuery

How can I get Picture Previews to work with IE 8 and up?
Can I get binary image data from an input type "file", with JavaScript/jQuery?
If I can just get the data (in the right format) back to the server, I should be able to work with it there, and then return it with AJAX (although, I am absolutely no AJAX expert).
There is, according to the research that I have done, NO WAY to get picture previews in all IE versions using only javascript (this is because getting the full file path is seen, by them, as a potential security risk). I could ask my users to add the site to the trusted sites, but you don't usually ask users to tamper with those kinds of low-level settings (not to mention the quickest way to make your site seem suspicious to users is to ask them to directly add your site to the trusted sites list. That's like sending an email and asking for a password. "Just trust me! I'm soooo safe!" :)
I have picture previews working in everything except IE and have no problem using conditional comments to separate an IE specific way of doing this from the way I am doing it with other browsers. In other words, the answer doesn't even have to be cross-browser, just cross-IE (8 and 9). I know I have seen IE sites use picture previews before (somehow), so I know there must be at least ONE way to do this...
So if you need to support IE lower than 10 you could upload the file to the server using some of the existing AJAX upload components (Uploadify, Plupload, Valums AJAX Upload, Bleuimp, ...), generate and store a thumbnail on the server and send the url to the saved image to the client using JSON so that it could display it using an tag. Actually since IE supports Data URI Scheme you don't need to store the uploaded file to the server in order to generate the preview. You could directly return the resulting thumbnail image from your Preview controller action formatted as Data URI Scheme so that you could show it on the client.
Another solution if you don't have the time and resources to implement this functionality is to simply tell your users that if they want to get a realtime preview of the image that they should consider using a different web browser because your site doesn't support IE for this.

Editing Documents (.doc) in Browsers

I've been developing a web application with asp.net webforms and in this app I have some documents (.doc, .docx, .rtf files), and my client want to edit these files on browser, they want to open a document in an editor, edit, save it on server (without downloading) and close it. I know it's difficult but I would like to know if it's possible or if is there any easy way to do it. We find something like SkyDrive of Microsoft.
PS: We can pay for components if you can suggest something that really works.
Thank you!
IF the clients have Office installed:
I would recommend http://www.webdavsystem.com/server - this allows you to build a "virtual filesystem" (WebDAV which is based on HTTP) which Office can access thus allowing the client to open/edit/save a document (DOCX etc.) via HTTP(S)... it is pure .NET, integrates nicely with ASP.NET and has even a JavaScript accessible API... esp. the upcoming V 3 comes with a wizard which allows you easily to add that funcionality to your ASP.NET application... (just a happy customer, not affilliated).
IF the clients don't have Office installed then it gets tricky:
To really fully support you would need some sort of Silverlight/Flash/ActiveX/JavaApplet which runs in the clients browser and supports the needed editing features...
I am not aware of such production-quality components except the ones from Microsoft - see http://www.microsoft.com/en-us/office365/online-software.aspx
You could integrate them into your web application although they won't offer the full Office feature set in the browser...

Control Printing in ASP.NET Page

I need to create a web application that prints checks. Because of the nature of the program, it needs to be very secure, and each action needs to be logged. I need to be able to generate a check, print a check, allow reprints if needed, etc.
I've got the generation of the checks completed. I've decided to make a PDF (so that i don't get any browser header/footer garbage). What I'd like to do is not even save that PDF to a file but to instead send the data directly to a printer. Basically, I'd like for the user to enter the amount of the check, select which account it's going to be printed for, then click a button that sends the data for that check directly to the printer. I don't even want the user to be able to view the PDF of what's to be printed.
Has anyone done something similar to this in ASP.NET?
Thanks.
[EDIT]
The original question I asked was answered with ActiveX controls. I, however, decided to do it a different way. Instead of printing a PDF, I've decided to create an image of the background of the check. I will then use that image (.jpg), and manipulate it by placing the appropriate text (MICR line, amount, check date, etc.) on it using System.Drawing.Graphics and stored X,Y coordinates and font preferences in my DB. From there, I can use the System.Drawing.Printing namespace to send the new .jpg file to a network printer from the web server, eliminating the need for an activeX control and further tightening security because the new image of the finished check is never saved, and the user never has access to the overlay of the check.
Thanks for your help.
If you look at how postal services tackle this problem, you'll notice that a simple web application won't do. To have control over how and when items are sent to the printer, ActiveX compontents or Java software is used.
[Edit]
Small clarification: I ment that the software has to run on the client-side as opposed to your suggested server-side suggestion.
If you want to go the .NET route, you're down to an ActiveX in Managed C++ or a Click-Once application that is launched from the web (allows more of the .NET language, but can be decompiled and altered).
We have implemented this scenario in a couple of ways. First, we have the traditional PDF solution, where the server generates the PDF print image, returns it to the browser which is then displayed via the PDF plug-in and optionally printed.
Second, we wrote a client-side ActiveX component to handle the print. Pass the input values to a backend web service which uses FOP to format the print into PCL. The PCL is passed back to the ActiveX component who then sends the PCL directly to the users default printer. No PDF required here.
Either way works, but only the second option - which will require you to implement some client-side piece - meets all your requirements.
There isn't really a way to do this. You can only send a document to the user which the user can then send to the printer. There are ways to prompt the print dialogue to pop straight up, but the web would be pretty insecure if you were allowed to control how data was managed on the user's machine.
NKCSS is right that it would require software actually installed on the user's machine. You have done as much as you can by making it a PDF that the user is prompted to print.
If you had the cheque as html, you can used styles to show/hide content just for the printer as discussed in this post: here
There's no way to do this completely securely. Even if you force the PDF to print directly to the user's default printer, that itself could be a PostScript or PDF printer like PDFCreator. So they could still get a viewable PDF in the end.

Microsoft Office Word in a web browser

I want to have a Microsoft office word inside a web browser so that i can get the control to format the text and specify proper indentation. I don't want a client side to save the document.
It should be the same as http://www.asp.net/ajax/ajaxcontroltoolkit/samples/htmleditor/htmleditor.aspx but i want an additonal component i.e RULER to it.
Is there a way i can get that kind of control or a MSword control without save button.
Please Help
You won't be able to get a "Word Control" into a webpage (not least since that requires every user of your site to have a copy of Word installed), but you can look into something like CKEditor, which is a WYSIWYG editor written in Javascript/HTML. Getting a ruler in there may be difficult though.
What are you trying to do? I'm not sure what your question is, but what you are referring to is a WYSIWYG editor. There are many versions and options for embedding one in your web page. You mention one already. Here's some more:
TinyMCE
Markdown
YUI Editor
Yes, there is such a MS Office control called aceoffix. It works like calling MS Office from local machine and embeding it in web browser. Users can edit,view and save document online diretly. Developer can also customize these functions, such as disable the "save" button.

Flash plugin that allows users to create a PDF or image file

I am developing a ASP.NET web site where users will need to be able to create their own business cards. So, I'm looking for a tool (most likely Flash) that I can easily integrate into a web site and lets users add text and custom images to their cards and then create an image and/or PDF from their work.
is there a plugin that does this?
If you write your own business-card creator in flash, you can save the view to PDF files using AlivePDF.
You could have a look at this: http://www.shirtnetwork.com/en
It is less of a plugin and much more of a fully customizable software solution, with an administration backend, PDF export, billing etc. . I worked on the client and I must say it is a very mature and potent software and probably can do about anything you want, when it comes to customizing products. I don't know, whether you like the pricing model, OTOH to my knowledge, they also provide provision-free licences.
I don't know, whether there are reasonbly expensive components available, that do this for you, because you can get a load of money out of this business, so I wouldn't expect anyone to give them away for free.
greetz
back2dos

Categories