I have a SWF file on my C# project and I want to execute the ActionScript code in it. Anyone see a possible way to do that directly in C# ?
Best regards,
Assuming that it is a Windows Forms project, maybe you can use the web browser tool. Put a panel inside the form. The size and location of the panel will be the size and location of the browser. Embed the swf file in an html page and load the page from your form through the browser tool.
I should warn you that I haven't tried this.
Related
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....
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?
Earlier, I used System.Diagnostics.ProcessStartInfo to pass website url and open it in internet explorer.
Now, I have a HTML page code in database. I am working on a Windows application. I need to dump code on browser when click on windows application button. What is best .Net library to perform this task?
I looked at Process.Start() function, but it take html file name. In my situation, I dont have html file.
Have a look at embedding the WebBrowser control into your application.
You can call the NavigateToString method and pass the HTML source from your database as a string for it to render.
Since you're using WPF, there's a nice guide on how to integrate a WebBrowser control into your application.
I want to know how I can view a PDF through a C# .net desktop App. I am trying to create a application to view PDF using visual studio 2008
There is a pdf reader libraries called iText(iTextSharp). But it didn't help me
You can host a ie web browser control in your application and that will allow the user to view a pdf if they have a reader installed.
I can provide an example if you tell me whether you are using WPF or WinForms.
Drag WebControl on to you form
Set the path in code
Done Press F5
I'm not sure what netbeans has to do with anything, but take a look at this question here How to render pdfs using C#
Essentially you need to get a 3rd party PDF viewer or write one yourself. There are quite a few around and would probably take a look at something like PDFViewForNet
iText isn't a PDF viewer.
If you want to read PDF documents in your application there are couple of Open Source PDF Libraries.
I'm using the flash 10 activex control to load a flash movie into my WinForm. Unfortunately, it only takes a path. What I'm trying to do is load the swf from a stream I can get from an EmbeddedResource so I can embed the swf into my exe such that A) I don't have to worry about paths and B) I don't have my swf quite so exposed - simpler for both usage and deployment.
I know of using f-in-box but I'd like to not add yet another dependency to my project. Is there a way to load the swf into the underlying activex control without having to use a path?
I'm using C# and .Net 3.5sp1.
Is that path always a file path? Or can it be a URL? It should be pretty simple to set up a temp localhost web-server using HttpListener (or similar), that streams back the file in response to an http request.
Another possibility would be named pipes; I wonder if you can convince the control to open a named pipe as though it were a file? (they have a logical file path, after all). I've barely touched these, though - so I can't say 100% whether it would work.
I don't know if flash 10 supports the res protocol to load web content from resource. But I think the web browser control in Windows Forms and WPF support it.
To create a native resource you need an editor of native resource. Visual C++ has one. You can use RC.exe in Windows SDK to compile it to res files before linking in your C# program.
Update:
Looks like the flash plugin for IE does not support the res protocol. embed the .swf file in a resource file and have it load using the movie parameter won't work. Try embed the Flash file in a web archive file (.mht) and add the .mht file to your resource.