Forums Register Login

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

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3724 times.
Similar Threads
File Download Problem:GIF,DOC
jQuery click function and ajaxcomplete not working.
JSp Output to PDF
Displaying 100 blob images in JSP
File Upload
J2EE Sending Message/Email from a Registered User to anoter user
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:54:58.