• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display PDF file only in a portion of the browser

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to display PDF file on the object tag or iframe tag of the html. The PDF file is from the local of my computer. I tried using this code:

by accessing through this link:

the user can access this controller

and should display the PDF file in the object tag:

but instead of displaying the PDF file in the object tag it display it on the whole page. What am I doing wrong?
 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Javaranch !!!

I have never used object tags but can you try reducing width and height to let us say 50%. Better if we can give width and height in pixels (for example - width=300 , height=200) . try this change and let us know if this has resolved your problem or not.

Rendering PDF in HTML Page may not work on all browsers. It depends on how the browser handles PDF files. Some browsers can render PDF directly in HTML page and some browser try to download it.

You can check PDFObject JS library http://pdfobject.com/ specially meant for displaying PDF in HTML Page. This website say that this library take care of browser compatibility issues.

~ abhay
 
james rod mantaring
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your warm welcome.

I try to give it a specific width and height looks good to me. Can you give a simple example of the link you gave me? with back end? I'm not that familiar with the samples they include there. Thanks
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
glad to know that your problem is solved.
Apologises I have not used JS library.
I got this JS library info from google.
So please search on google about its code sample and examples.

~ abhay
 
reply
    Bookmark Topic Watch Topic
  • New Topic