Forum How do I...?

Prince and Flash (.swf)

stever
Hi,

Newbie to Prince here.

I have successfully tested Prince to convert my web files to really nice CSS'd pdf documents...except for one element.

Our web pages have Flash Movies in them ( .swf files ). The return from Princexml just shows a grey box with the word 'Flash' in text in the middle.

From what I understand, Prince cannot handle .swf files so it returns that object. What I would like to know is how can I locate that object and customize it so that it better suits our design requirments for this project.

In essence, I would like to customize each instance of a Flash Movie with screen capture of the Flash Movie and a URL to the actual Movie on the site.

I am assuming it is internal to Prince and is styled by CSS?

Any thoughts?

Thanks,

steve
[/img]
mikeday
The styling of flash objects is specified by CSS rules in the default XHTML style sheets located in lib/prince/style or Prince\engine\style on Windows. The current rule looks like this:
embed[type="application/x-shockwave-flash"] {
    display: table-cell;
    width: attr(width, px);
    height: attr(height, px);
    content: "Flash";
    background: #f0f0f0;
    color: black;
    font: bold 12px sans-serif;
    text-align: center;
    vertical-align: middle
}

You can replace that with whatever you like, or you can just override it with different rules in your own style sheets.
stever
I got it.

We are thinking about writing a script to handle this internally per document as some documents may have multiple Flash files in them and we would like to add custom links and images to each one- possibly by tagging embed IDs

Any thoughts on that one?

Thanks again for your quick response.

stever
mikeday
Some of this could be done with CSS:
embed#id1 { content: url(images/thumbnail1.jpg) }
embed#id2 { content: url(images/thumbnail2.jpg) }

If you want to do more complicated transformations of the content you could always use XSLT, or Perl, or whatever templating language you have handy.
kmmv
Alternatively, you can use correct <object> elements and write your own custom CSS that displays the appropriate fallback. It has the added benefit of showing fallback content to non-Flash capable users, too.