Title: height attributes
Last modified: June 12, 2018

---

# height attributes

 *  Resolved [imcobarn](https://wordpress.org/support/users/imcobarn/)
 * (@imcobarn)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/height-attributes/)
 * Hi,
 * Thank you for this great plugin.
 * I see in the code `if ( isset( $atts['height'] ) ) {`
 * Does that mean we can somehow set the height of the iframe?
 * Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/height-attributes/#post-10393573)
 * You can’t set it directly, but the media files attributes are merged and preferentially
   used.
 * If this is something that many want to do I could put in a filter.
 *  Plugin Author [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/height-attributes/#post-10396640)
 * I’ve added a filter in the develop branch.
 * [https://github.com/afragen/embed-pdf-viewer/issues/3#issuecomment-397022933](https://github.com/afragen/embed-pdf-viewer/issues/3#issuecomment-397022933)
 *  Plugin Author [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/height-attributes/#post-10517260)
 * This has been merged.
 * You can use the `embed_pdf_viewer_pdf_attributes` filter hook to return an array
   of height and width.
 *  Thread Starter [imcobarn](https://wordpress.org/support/users/imcobarn/)
 * (@imcobarn)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/height-attributes/#post-10523511)
 * Thank you very much, that works.
 * I copied code from the Github and code below is what I’m using.
 * I was trying to add “100%” width so it would scale on different screens but the
   function add “px” to the end of attribute so even if I add “500px” in new filter
   hook it would return 500pxpx on the page.
    So in the hook dimensions need to 
   be without px.
 * Anyway to get around that?
 *     ```
       add_filter( 'embed_pdf_viewer_pdf_attributes', function($attr) {
           $attr['height'] = "600";
           $attr['width'] = "1000";
   
           return $attr;
       });	
       ```
   
    -  This reply was modified 7 years, 10 months ago by [imcobarn](https://wordpress.org/support/users/imcobarn/).
 *  Plugin Author [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/height-attributes/#post-10523881)
 * This may be difficult as the fallback is for the iframe, which specifically writes‘
   px’ in the code. However, the object tag only has a number and it uses pixel 
   for the unit of that number.
 * Given that, I’m not sure there’s a way to accommodate. Sorry.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘height attributes’ is closed to new replies.

 * ![](https://ps.w.org/embed-pdf-viewer/assets/icon.svg?rev=2883712)
 * [Embed PDF Viewer](https://wordpress.org/plugins/embed-pdf-viewer/)
 * [Support Threads](https://wordpress.org/support/plugin/embed-pdf-viewer/)
 * [Active Topics](https://wordpress.org/support/plugin/embed-pdf-viewer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/embed-pdf-viewer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/embed-pdf-viewer/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/height-attributes/#post-10523881)
 * Status: resolved