问题
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
回答1:
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).
来源:https://stackoverflow.com/questions/11084694/how-does-a-plugin-resize-its-window