view swf in asp.net website and determine if it was viewed - c#

I have a request to host a swf file in an asp.net web page. That works using an object tag. My problem is that I need to determine if the user viewed the entire swf file or part of it. I do not see any events in the HTML object tag that are related to reaching end of the file.
Is there a way to detect that an end of an swf file has been reached in an asp.net web page?

nope, swf is a relatively closed format, not good for SEO the content inside.
I think there is no way to manipulate inside it by (client or serverside language) without communicating with its actionscript.
so i think you need to use swf source file the .flash source code to add some triggers
(using actionscript 2 or actionscript 3)
to send request to server to do counting when the swf movie enter the lastframe.
BUT
if you convert the flash swf to other relatively open format such as mp4 etc, you can easily adquire the playing progress of it. using html5 video tag or framework such as video.js

Related

Getting rendered html final source

I am developing desktop application. I would like to grab remote html source. But remote page widely rendered by javascript after page load.
I'm searching for a few days but i could not find anything useful. I've studied and tried to apply the following suggestions. But I can get only base html codes.
WebBrowser Threads don't seem to be closing
Get the final generated html source using c# or vb.net
View Generated Source (After AJAX/JavaScript) in C#
Is there any way to get all data like html console's approach of firebug?
Thank you in advance.
What are you trying to do? A web browser will do more than just grab the HTML. It needs to be parsed (which will likely download further files) and rendered. You could use the WebKit C# wrapper [http://webkitdotnet.sourceforge.net/] - I have used this previously to get thumbnails of web pages.

How to extract a PDF from an SWF player on a web page?

There is a book on this page (http://img.docin.com/players/DocinViewer.swf?productId=463932528), and it is inside a swf player. Previously there was a software which can extract all pages in the swf player and store them as a pdf file.
So there should be 3 steps:
Find the file source inside the swf player
Extract all pages from the swf player.
Save them as a whole pdf file.
How might one accomplish this?
I don't know the exact answer, but perhaps someone can expand. It seems to me that using these two references, you could search for the PDF in the stream you get back in the SWF to identify the SWF header, and structure, and the PDF header and footer and then reconstitute the PDF directly from the stream:
http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf
Structure of a PDF file?
Alternatively maybe an existing tool will do the trick:
http://download.cnet.com/SWF-Printer-Pro/3000-10743_4-10740922.html
Or update the open source project below, mentioned by a commenter to the level you need, using the references for the newer SWF and PDF formats:
http://sourceforge.net/projects/swfdotnet/

Server-side printing in C#/ASP.NET

On the server that my application is being run on, a virtual PDF printer is being installed (don't know much about this yet, except it's from Adobe), and my application needs to use this 'printer' to create PDF's from HTML pages (a GridView mostly), and then redirect the user to the URL of the where the PDF is stored.
I've been looking at the PrintDocument object in System.Drawing.Printing, however I've read that you can't simply feed this a HTML page. What are my choices? The easiest option would be to be able to 'print' a given HTML page (choosing what and what not to print using CSS), but from what I've read this is fairly difficult, so I'm thinking about somehow constructing whatever object PrintDocument needs programatically, if that makes sense.
Any ideas on how I should do this?
there are some free/cheap libs for creating pdfs on the fly. I've used itextsharp before and it worked pretty well. Takes a bit of time to get up to speed in how it works but I'd suggest checking it out.
There are also printing services like Neevia DocConverter that will monitor a folder and auto convert whatever you put in the folder to a pdf, jpg, etc. you can set it up so that if you drop a url shortcut in the folder it will render the webpage at that url to pdf. it's a bit more of a pain if you want to do realtime rendering but works excellent for generating mass reports in batches that you want to post up to a website or email later.

How could i paly a video & audio file on an asp.net page?

How could i paly a video & audio file on an asp.net page so that the file is determined on the run time
ASP.NET itself has no capabilities to do this as it's a server side technology. What you can do however is put html, just like like you would do in a standard html file, to display these.
If you can already make use of html5 then you're in luck as it provides dedicated tags like <video> and <audio>.
I wouldn't do this in ASP.NET myself, I'd use one of the jQuery plug-ins that make this easy. Check out the jQuery Media Plugin as an example.

Response.BinaryWrite DIV

Is there a way to write PDF to a div from DataBase i.e. Retrieve a Byte[] from Database and Reponse.BinaryWrite to a div.
We do similar thing for Images using src = "anotherpage.aspx" where image is written on anotherpage.
Is it possible with PDF without using IFrame?
If what you're trying to do is show a PDF file inside a DIV, you're going down the wrong path. You either need to:
Convert the PDF to Flash (ala Flash Paper)
or
Convert the PDF to HTML (like Scribd does using HTML 5).
Then you can embed the PDF inside a DIV. But no browser I know of supports directly embedding PDFs.
Otherwise you have to put the PDF in an IFRAME, but how this is shown is PDF plug-in dependent.
No. The reason it works with a src=otherpage.aspx request is that the src attribute results in the user's web browser making a completely separate request for the other resource. You're serving up an additional page to make that happen. Writing a PDF file directly is trying to inject the PDF into the same request as your page - not really "similar" to your img src at all. In fact, what is most similar to the "src=otherpage.aspx" method is the iframe approach that you mentioned.
As a side note, you our "AnotherPage.aspx" example should really be changed to "AnotherPage.ashx". Note the letter 'h' in there. That means you're using a handler rather than a page, which will perform better.

Categories