4

When I load a pdf with the following html the pdf plugin seems to resize it's windows to accommodate the complete length of the pdf file. I'm wondering how the plugin does that?


<!DOCTYPE html>
<html>
<head>
<title>Test html object tag</title>
<style type = "text/css">
    html
    {
        height: 100%;
    }

    body
    {
        margin: 0;
        padding: 0;
        height: 100%;
    }

    .my_style
    {
        width: 100%;
        min-height: 100%;
    }
</style>
</head>

<body>
    <div class="my_style">
        <object class = "my_style" data="data/test.pdf" type="application/pdf"></object>
    </div>

</body>
</html>

As far as I understand it the size of a window that is provided to a plugin is defined in the html object tag.

Thanks, Christian

chhenning
  • 2,017
  • 3
  • 26
  • 44
  • Keep in mind that unless the Adobe Acrobat plug-in uses FireBreath, the answer of how the PDF plug-in resizes its window will be very different from the way *you* should use to resize *your* plug-in. – Rob Kennedy Jun 18 '12 at 14:27
  • I realize that the various pdf plugins don't have to use firebreath. I just trying to understand how they do it. Ideally, I like to do same with firebreath. – chhenning Jun 18 '12 at 15:26

1 Answers1

2

This is pure speculation, since I don't have the source to said plugin, but if I were trying to solve this issue I would simply get a reference to the object tag of my plugin and set the width and height.

Haven't tested this code, but something along these lines should probably work:

FB::DOM::ElementPtr elem(m_host->getDOMElement());
elem->setWidth(640);
elem->setHeight(480);

Obviously wherever you do that you need access to the BrowerHostPtr (m_host).

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • I'll try this tonight on the Mediaplayer example. You think I have to issue a refresh on the browser side? – chhenning Jun 18 '12 at 20:32
  • Hi Richard, good news. I have added your code in the onWindowAttached event handler and it works. No refresh necessary. This is great! – chhenning Jun 19 '12 at 01:35
  • refresh would have defeated the purpose of the idea. I see you're pretty new to SO; if you want people to keep answering your questions, it would be a good idea to start upvoting helpful answers and comments and flagging answers as correct. – taxilian Jun 19 '12 at 02:42
  • 1
    Richard, I would love to upvote but I don't have enough reputation points just yet. Only four more points... – chhenning Jun 19 '12 at 13:29
  • That makes sense... but you should still be able to flag questions as the correct answer =] – taxilian Jun 19 '12 at 14:12