0

I am trying to add a PDF that will automatically display. It works in Firefox and Explorer, but not in Chrome. Additionally, I cannot manipulate the height--any ideas on this?

HTML:

<center>  <div class="pdf">
<object data="pdf.pdf" width="600px height="5000px"
    type="application/pdf">  <p> You don't have a functional browser. </p> </object>    

CSS:

.pdf {  
height: 100%;  
width: 100%;  
margin: 2em auto;  
border: 5px solid #FFFFFF;  

}

.pdf p {  
padding: 1em;  
}  


.pdf object {  
display: block;  
width: 100%;  
height: 100%;  
border: solid 1px #666;  

}

2 Answers2

0

It's up to the browser how it wants to handle your PDF and whether or not to display it in the browser window or in the application that it wants to display it in. You can try and use iframe's to get it to listen to your display height/size. Additionally, you can try to use a library like ViewerJS to display it in your page without relying on local system configuration/plugins.

someone1
  • 3,570
  • 2
  • 22
  • 35
0

don't use center property as it is outdated, very outdated. use css instead...

example:

<div style="height:20px;width:100%;">
  <div style="height:20px;width:40px;margin-left:auto;margin-right:auto;"></div>
</div>

example explained: specify the width for the parent div and child div then use margin property to make it align the child div in the center of the parent div. the margin:auto property makes an equal margin on both sides.

please reply back if you need more help or this is not what you are looking for

oh and for the main question. try using an iframe with the source as a pdf and this should allow you to manipulate the size (with javascript).message me if you need more help

Mudassir
  • 1,136
  • 1
  • 11
  • 29