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

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.

Related

How to convert PDF files to swf or HTML for viewing in C# MVC 4.5

I have hundreds of PDF files that i need to present to users. When presenting these files through my MVC web app i don't want the users to have the ability to download the files, e.g.. i don't want the Acrobat reader controls for print/save showing up. Reading this stackoverflow post it seems that it's not possible to disable those controls.
I know users can still take screen shots and print out the page, but that's not an issue in my case.
What is the best way to go about this. I've reasearched using SWFTOOLS which looks like it may be a good solution, but i dont want to save the swf files to my filesystem. The optimal solution is PDF.js, but another problem i have is users will be accessing the files through IE8 - so PDF.js is out of the question. Unless there is another similar library that will convert the files to HTML 4.
Basically I just need to display the PDF files, on the fly would be best, in a different format than PDF
Any suggestions?
I had a similar project a while back, where sensitive pdfs were needed to be displayed to specific users but they weren't allowed to download/print/save it.
Since it was a web app I ended up using pdf.js. It is Mozilla's PDF renderer for firefox. It renders the pdf on to a canvas and by default has all the bells and whistles. If you have firefox, open a pdf file to see it in action.
It was tough to get it running at first but I ended up using a demo I found online as the base of the project. After removing each functionality that was forbidden the finished product did exactly what was required. You will need to add a print css file to block printing or find a better solution. I ended up using the css approach since print preview by passed my javascript check for the print action. Also ensure you block ctrl + s which allows the user to save the pdf.
Another aspect to note is that it works better on later versions of IE and struggles on older versions as the file size increases. Firefox and chrome are not a problem and I believe its the same for opera although I haven't tested that.
I would convert it to an image file, you can find tools or write script to do it, I personally would do it by displaying them in browser first and then use browser plug-ins to take screenshot of the entire webpage.
(you can automate this)
then just display then converted pdfs
**this is probably not the best solution :( **

ASP.NET c# Creating a PDF (both Rotativa and ITextSharp) how to modify the ViewerPreferences dictionary to turn off print scaling in adobe readier

We are generating PDFS from a web app a couple different ways, ItextASharp, Html->Rotativa, and RDLC...
Is there any way in anyof those tools to modify the ViewerPreferences dictionary inside the PDF so as to disable the "shrink to fit" option..
The PDF format supports this option, I've found documentation for that...
I'm aware that not all viewers honor the request not to shrink to fit, but we're using stock adobe readers across the board so it's ok.
I was able to find this in ITextSharp to read one, modify it and save, it, so I have to believe there is a way to set it before generation...but I can't find it..
Determine properties such as if PDF is Simplex or Duplex in iTextSharp
It'd be awesome if Rotativa had a way too...since we use that for some reports
We also have some done in RDLC style, if there is a way to do it there...
The reason we have to do it, is one of our apps prints labels and the amount of data leave no room for fudging it. Printing them from a web app is problematic, even when we control the ecosystem.
Unfortunately, our IT group will not use the reg settings to change the default on the machines.. we have to do it through code.

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.

Previewing TIF documents on the Web (.Net C#)

I am looking for a way to display TIF documents on a web page. It basically needs to render a Multi-page TIF in some form of container on a web page.
Do I need a control or is there a simple way to build something like this? Is there any free stuff that we could simply implement?
I have looked at the Telerik reporting product which apparently contains a Tif viewer. I haven't looked into the licensing for this though. (If I only need the TIF Viewer, do I need to purchase the entire reporting solution?
Our biggest issue at the moment (like always) is that we have a very tight deadline with very little available resource. This product will be installed at a client so ActiveX controls that request user permission to install are less than ideal.
Any suggestions and/or comments would be welcome.
Thanks
If you want to try and roll your own (this would be a lot of work), you can use the System.Drawing namespace to convert TIF images to a browser-supported format, like PNG or JPG, or a third party library like AbcPdf to go to PDF as Lazarus suggested. The problem here is that you would have to create and code-behind a toolset for magnification, cropping, and multi-page support, along with whatever else you would want, which could be quite a bit of coding (unless you went to PDF and relied on Adobe Reader). Also, the server-side conversion can be prohibitive for speed if you're dealing with large TIF files or with formats that aren't supported.
As far as vendor solutions are concerned, I don't know of any good free viewing plugins off-hand. R Ubben is right; Snowbound's viewer is nice, but if I recall, the AJAX version requires it's own website that you pass the image to, which then gets rendered to the client, which may bring up some security issues (and leaves a bad taste in my mouth anyway). Atalasoft has an excellent AJAX image viewer and a very powerful imaging SDK, but it does cost a bit. My current company has settled on an ActiveX plugin from Pegasus Imaging (recently merged with Accusoft) called Prizm Viewer. The viewer itself is quite powerful, can handle many image formats, and is scriptable. It does have drawbacks (beyond being an ActiveX control). We've had some trouble with our desktop deployments as the default install will only push for the current user as opposed to the local machine, but we've fixed that with a post-install registry hack.
I would say that, if you have the cash and want a robust imaging solution, go with Atalasoft. Otherwise, Pegasus is fairly cheap and works just fine, unless you have severe aversions to ActiveX. There are lots of other options out there, it's just a matter of how much money you have and how much coding you want to do.
Use a library server-side to convert the TIF to a PDF (assuming that it's a common plug-in that most people have) which will eliminate the need to install another, convert each page of the TIF into a GIF or JPG and present those, again fully supported by browsers eliminating the need for an additional plug-in.
You could probably do this conversion on-the-fly and then cache the output to reduce subsequent loading times.
There's a good, free viewer that has an ActiveX version for IE and a Mozilla plugin for Firefox. Alternatiff. It's free but requires registration that's fairly painless.
# R Ubben
Thanks for mentioning our AJAX application! There is a live version of the ajax document viewing application, VirtualViewer, available at http://ajaxdocumentviewers.com and a free trial download. VirtualViewer may be overkill for simply viewing TIFF images on the web - depending on the size of your organization - so we also provide the RasterMaster SDK so you can build your own file conversion and viewing apps.
Doug
Snowbound Software has a pretty good image viewer. It does not use ActiveX. Displaying tiffs is not difficult, but sometimes you need something quick.
I've used Adeptol's AJAX Document viewer to do the same thing. Works great and easy to implement.
i'm just looking for the same..
found this:
http://www.neodynamic.com/demo-faq/imagedraw-aspnet/imagedraw-aspnet-multipage-tiff-viewer-sample.aspx
hope it can help, otherwise if you find something better, please let me know by inbox :)

ASP.Net Converting and Merging documents into single PDF

I need to have the ability to convert and merge various documents into a single Pdf.
The documents could be of varying types, such as Word, Open Office, Images, Text, Web pages (by URL) and the PDF would usually consist of 2-3 documents.
At the moment, we are using BCL Technologies easyPDF with Microsoft Office installed onto the Server. This handles most documents but we haven't had it doing Open Office ones yet.
We currently produce around 100-1000 of these PDF's per day.
The reason I am asking the question is that performance is a key issue. The PDF is generated for users on the fly and so the waiting times we are currently getting of 30-60 seconds is becoming unacceptable.
We have done some caching around documents when they are intially uploaded so the main tasks that happens when a User requests a Pdf is merging a number of already generated Pdf's.
Does anyone else have any other tools they have used that work reliably for most common document types and above all, quickly? When put like that, it seems like I'm asking a lot!
Edit:
Thanks for all the great advice, I'll look into some of these and compare performance.
Just to add to all this, money is not really an object. We're more than happy to pay for different applications to perform each task as well as looking into various hardware options to distribute the load as much as possible.
Merging multiple PDF documents is normally simple enough (as long as they don't need to be merged on the same page) - you could compare your merge performance with something like iTextSharp (.NET version of iText) to be sure it isn't a bottleneck - otherwise the conversion from other formats to PDF is likely the bottleneck.
In almost all cases, the method used to convert X to PDF is to execute the applications print command, targeted at a software PDF printer, to create a temporary PDF file.
This means:
The target application (for example Office) is opened and closed
The document has to travel through the printing service
In your situation, are you converting arbitrary documents submitted by the users, or do the documents come from a stored library of files? If it's a library, you could make a PDF copy of each file as it is added to the library (instead of when the user makes a request), and then only merge the PDF files.
We use ABC Pdf. I don't know if it will be fast enough for your needs, but it seems to work for our use.
I had a very similar issue where we had documents that were already existing in PDF format and needed to allow the user to see them all combined together. We purchased the PDF4NET product which was about $500 from what I recall. It was extremely easy to use and they provide awesome examples of how to use the tools.
O2 Solutions - PDF4NET
Here is the code sample that they provide for merging. The top line looks like it just outputs the file, the second 2 lines allow for streaming the content back to the user.
PDFFile.MergeFilesToDisk( "append.pdf", "unicode.pdf", "multicolumntextandimages.pdf" );
PDFDocument doc = PDFFile.MergeFilesToDoc( "append.pdf", "unicode.pdf", "multicolumntextandimages.pdf" );
doc.SaveToStream( stream );
You say you're using Microsoft Office to open these files, I would imagine this is the bottleneck rather than the actual PDF creation.
Is it possible to distill these documents into a more accessible format (html/xml/database), so that it's not necessary to open office every time a PDF needs to be created?
While I have no PDF conversion suggestions I can say that this problem sounds like one which could be distributed over a number of nodes. Do you find that the PDF generation is CPU-bound or are there other limiting factors? Before expending too much effort on rewriting the PDF library interface you might want to see what the bottlenecks are.

Categories

Resources