Including a .SWF file in a C# Webform - c#

I'm currently working on a project where i need to include a application page for users. I need the users to access few .SWF flash games through this page. I created a folder named applications in the Application and imported the .SWF files into that. After that I tried directly linking them using a hyperlink on my page, but they don't seem to open :/
am i missing something? or is there something else i need to do before that?
Would really appreciate it if you can help
Thank you

I don't think you can just hyperlink to your .swf file. According to this site, and your using Dreamweaver or FrontPage, you can just insert it from the Insert menu (or something of the kind). If you aren't using either of those two, you can edit you .swf file in Flash and choose "Export as HTML" from the file menu (or where ever it is) and then just copy the source code of the resulting file to your webpage.

Normally, you should be able to open .swf files directly in your browser, although embedding the swf into your html is often a good idea, you don't have to.
If the url in your address bar shows an adress ending with '.swf' you can test if a swf has loaded by right clicking in your browser window, if you see the flash context menu (zoom in, zoom out, etc) Your swf has loaded.
If your swf has loaded, but nothing else happens, there can be many other reasons for this.
Where did you get the swf game files? If you copied them from another site it's very likely that the swf is supposed to load other files (game assets (images), settings (xml) etc) before the game can be played.
Sometimes the execution of (actionscript) code in a swf is triggered by script in the html page it is embedded in.
It's not entirely clear what you are trying to do....

Related

Save file automatically without prompting to save it in web browser

In downloading any PDF Files, we need to click on save as popup window in IE and saving it into a folder.
Now, as an automation project, I want that save as popup window should be automatically clicked and it should save the files in the provided folder.
Kindly help us in C# code.
Many thanks.
I don't know if you can set it through code because its all about browser settings also I don't find any option in IE. However in Google Chrome you can customize your downloads using its setting. Please ask the users of your application to start using Chrome (if possible) and change its downloads setting as per the screen shot given below:

WPF doesn't let local HTML file access an object in my disk

I use a Marmoset viewer .mview file and a html file from my local disk that should load it. I plan to make appear the 3D scene in my wpf browser.
The browser itself works, can display marmoset scenes found online, but cannot retrieve the .mview package. I tried this thread here as well but to no avail: the html file loads but can't access my other file (they are in the same folder as needed).
How can I allow a html file to get access to my local disk to load that file? (All that marmoset needs to show the scene is to have the .mview file in the same folder as the html file that loads it. Everything else is done by a script that comes with the export).
The reason this didn't work was that WPF integrated browsers (default IE, gecko or cefsharp) regards accessing your hdd a security risk for software so they block this opportunity.
To get around this, Marmoset suggests a local http server named "mongoose".
Furthermore, marmoset exported viewer files work by running a JavaScript file they access via the internet by default. To make your wpf projects both more robust and secure, download that JS file and add to your project.
That way I could fully integrate a marmoset realtime viewer inside any WPF container (I had a window, in it a user control, in it a grid. the page was shown in the grid).

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

Automated copy of selected text in pdf file loaded using web browser control in c#.net

This is what I have done:
I have loaded a pdf file in web browser,
Now I want to select text from that file and paste into a text box.
Can anyone help me?
I'm pretty sure that this is going to be prohibitively difficult, if not impossible, to do.
The browser does not 'run' the PDF, it acts as a host for the PDF application, which ends up sharing it's main window. After that, control of the cursor etc passes to the PDF application and the browser is effectively no longer aware of what happens inside it. If the PDF application being used exposes COM interfaces for manipulating the cursor/text selection (doubtful), then it's possible to script against those interfaces from client script - but you won't be able to actually run any script in that window because the browser is showing a PDF, not a web page.
It might be possible if you hosted the web control on a windows forms application, but even so I wouldn't even know where to start on that one.
If your goal is to extract text from the PDF then you're probably better off pushing it through a .Net PDF library. A quick google on that one will yield you some suitable libraries.
if your pdf file has form elements then the file can be submitted to a url.
check this link.. it might help.
Can a PDF fillable form post itself to an HTTPS URL?

How to open any file in a iframe

i am using a iframe in my web page. I want to open a file c:\Dir\SubDir\xyz.doc inside a iframe.How to do this ? I checked out many sources ,all of them specified to give the source of the iframe to the path by adding the code.Its not working for me. Here is my code
iframe1.attributes["src"] ="c:\\Dir\SubDir\xyz.doc"
assuming you want to open a file on the client's computer, you would need to use a file URL, such as "file://c|/Dir/SubDir/xyz.doc". that said, it still may not work correctly for various reasons (probably primarily security-related).
if my assumption is wrong and you want to display a file on the server, you still need to use a URL and not a file path, meaning you'd have to have the file somewhere under the document root: "../Dir/SubDir/xyz.doc" for example.
then there is the strong likelihood that a .doc file will not render correctly on a webpage.
<iframe src="test.doc"></iframe>
above example is working in my environment, cause I put file inside my project folder and access that file from there..
you can not open any file out side of your project folder.... So please keep this in mind.
#jcomeau_ictx is right you cannot open .doc file in browser but yes it will ask you to save file, if you put in iframe..

Categories

Resources