Coder Social home page Coder Social logo

Comments (6)

pplonski avatar pplonski commented on June 1, 2024

Hi @tinidoooooooog,

Could you please double check if file example.pdf exists in your directory and is accessible with provided path. I've just checked and it looks like this on my machine

image

What is your use case? What would you like to build with Mercury?

@apjanusz I think we are missing docs/example/tutorial for displaying PDF in Jupyter notebooks and Mercury.

from mercury.

tinidoooooooog avatar tinidoooooooog commented on June 1, 2024

Thanks for quick response.

I am running Mercury using docker +nginx on my remote machine instead of on my local machine (btw, PDF viewer works normally in my local version of mercury as well)

I am doubting if the problem occurs as the IFrame function is called
Could you please give me some suggestions? Thanks!

from mercury.

pplonski avatar pplonski commented on June 1, 2024

Do you get error when trying to access file with some other Python code?

content = None
with open(file_path, "rb") as fin:
    content = fin.read()

@apjanusz could you please check if there is a good error message if we try to access not existing pdf file.

from mercury.

tinidoooooooog avatar tinidoooooooog commented on June 1, 2024

In my case,
error message show up correctly file does not exist and no message pop up if existing pdf file name is given.

from mercury.

tinidoooooooog avatar tinidoooooooog commented on June 1, 2024

@pplonski I found the root cause to this issue. The issue comes from the Data URI limitations. In Firefox, the size limitations are looser than in Chromium-based browsers (<1.5 MB) so mr.PDF works as expected in Firefox.

It would be helpful If you can help fix this using approaches not based on data URI. Thank you!

from mercury.

tinidoooooooog avatar tinidoooooooog commented on June 1, 2024

I resolved the issue. By saving the file in the media folder, one can access it via
from IPython.display import Iframe
filepath = '/app/mercury/media/abcde12331/example.pdf' # assuming this
url=os.environ.get("MERCURY_SERVER_URL"),'/'.join(filepath.split()[3:]) #extract media/abcde12331/example.pdf from {filepath}
display(Iframe(src=url,width=width, height=height))

from mercury.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.