• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
james rod mantaring
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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?
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic