How to change the height and width of a Page Viewer web-part based on the size of the content?
Regards, Korak
You can user below script in ScriptEditor webpart below your Page Viewer WebPart to make show it in full page view.
<script language=”javascript”>
var a = MSO_ContentTable.getElementsByTagName(“table”);
MSO_ContentTable.setAttribute(“height”,“100%”);
for(i=0;i<a.length;i++)
{
a[i].setAttribute(“height”,“100%”);
}
var z = document.getElementsByTagName(“div”);
for(i=0;i<z.length;i++)
{
if(z[i].id.indexOf(“WebPartWPQ”,0) >=0 )
{
if(z[i].hasChildNodes())
{
if(z[i].firstChild.nodeName.toUpperCase() == “IFRAME”)
{
z[i].firstChild.setAttribute(“height”,“100%”);
}
}
}
}
</script>
For further information, Please check below mentioned MSDN article.
Story of a mischievous Page Viewer Web Part
If you want to set only height to 100% thank kindly check below link
Here is a library that can help you: https://github.com/davidjbradshaw/iframe-resizer
In this package there are two JS-files, one for the host (SharePoint) and one for the page that you want to show in the iframe. Once both scripts are implemented they will start to negotiate a size for the iframe so that all the content fits inside.