Convert HTML with SWF to Pdf or JPG - c#

My aim is clear. I would like to convert(capture) websites from given url which is HTML page with SWF included to PDF or JPG file.
I need to do it as a batch operation so lib or SaaS is ok for me.
Could anybody recommend any third party solution? It could be library or for example service in the cloud. It can be paid of course.
What I was trying are for example:
EVOPDF library which required flash player to work but I cannot install flash on the server cause of it is security risky.
cloudconvert (BETA) does not work (swf container is empty)
PrinceXml does not support
web2pdfconvert.com does not work (swf container is empty)
and many others with no results..

If you cannot install flash player how do you expect to capture the SWF data? You need to be able to draw the SWF or it will always be blank.

Related

iframe resource interpreted as document but transferred with mime type application/vnd.ms-excel

I am developing asp.net mvc 5 web application using c#. I am trying to display excel file in iframe
<iframe src="../../Data/ExcelSheets/ProjectExpenditureDetails/20170917184328709.xls" width="100%" height="500"></iframe>
When page loading always download the excel file and it is not displaying on the iframe.
Web developer tool says: resource interpreted as document, but transferred with mime type application/vnd.ms-excel
I don't know my approach is correct or not. If it's correct how to solve my problem. If it's wrong what is the best way to display excel file in web page.
I don't believe there is a way to do this natively in a browser. There are likely plugins that would allow it, but on a web site you can't guarantee someone will have that installed. I believe third party services are able to provide a some javascript that allows you to open a document. Google docs does something like this.
Think about flash applications (that used to be a thing). They contained proprietary code that wouldn't run in a browser without a plugin installed. XLS files are similar. There are some exceptions, but mostly a browser can only be expected to understand html, css, javascript, and a number of image formats. Even PDFs require a plugin to view, you just don't see it very often because many browsers make that fairly seamless now.
Unfortunately if you want to do this through a web site that needs to be secure I believe the route to go is actually replacing the shared sheet with application based functionality. Your clients may feel more comfortable about moving to google docs based sheets, which can be shared, but mine wouldn't touch it with a 10 foot pole. I'm not sure it is warranted, but that is how they feel.

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 :( **

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.

how can i use zxing in html5?

I currently have the zxing lib running on my silver-light project.
It's not lightning fast but it works fine and accurate.
However... the limitations are that some people use Linux and silver-light don't run very well (If at all) on some Linux platforms even with mono (moonlight)
So I'm trying to develop something that will decode bar-codes directly from an html5 page then send this information to my server by calling a service.
I am using c# at present.
I have the zxing jar files but have very little to no idea how to utilize them in an html5 page.
I have the webcam up and running using the html5 getUserMedia and can grab a frame from the stream and put it into a canvas, but can not work out how to integrate it with the zxing library.
Any and all help will be well appreciated.
There are a few native JS barcode scanning libraries out there that you could use:
http://badassjs.com/post/654334959/barcode-scanning-in-javascript
https://github.com/manuels/unix-toolbox.js-exact-image/
https://github.com/LazarSoft/jsqrcode
The last one is apparently a port of zxing, though it looks like it is tailored to QR code scanning.
I'm working on something similar. Trouble is, I've not gotten it to completely work either. But maybe this can help:
Like you, I've gotten an HTML5 webcam with a canvas to capture stills of the barcode. To use the ZXING stuff, you'll need to either compile the java files from source yourself, or get a pre-compiled .war file and find some way to host the servlets. I'm hosting mine using tomcat with the pre-compiled war pulled down from the maven repository (http://repo1.maven.org/maven2/com/google/zxing/zxingorg/2.2/) .
Once that's set, the ZXING decoding servlet is expecting either a URL or a file from an html form that has its action set to the url of your decode servlet. So you could take captured barcode on the canvas, save it to a file, and then have the user manually submit the file via the html page(exactly like the zxing.org web version) and that would work. However, if you wanted to seamlessly take the captured still and send it to the ZXING decoder, it's a bit more difficult and that's where I'm stuck as well.
I used javascript to convert the canvas's image to a blob first (and mind you, this only works in Firefox, since Chrome doesn't support canvas blobs yet. no idea about IE). Then I created a new FormData object, giving it the existing id of a form on the webpage, and appended the blob to that form. Then I used a submit button on the webpage to do the actual submitting of the form, which sends it via post to the decode servlet. I then get a nice white page with a console error about the character encoding of a plain text document not being declared.
I've also tried creating a new XMLHttpRequest in the javascript file, appending the canvas blob to that rather than an existing html form, and submitting via that. According to the console, that seems to get a bit farther (the console will show whether it redirected to a "results not found" page or to the results page), but I can't actually see/manipulate the output data.
Sorry I can't be of more assistance. I'd love to see someone get a completely web based version of this working since ZXING seems to be really good at the decoding process.

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 :)

Categories

Resources