izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
108 stars 30 forks source link

eps figure converted from pdf doesn't show #176

Open zpxzgh opened 7 years ago

zpxzgh commented 7 years ago

I got a visio figure named "a.vsdx", then I converted it to a pdf figure named "a.pdf" through the adobe PDF printer in visio 2016, then I converted "a.pdf" to a eps figure named "a.eps" using the "save as" in acrobat DC 2015.

The interesting thing is, when I insert "a.eps" in my "test.tex", the page in "test.pdf" where the figure "a.eps" should be turns out to be totally blank in atom-pdf-view, but when I open "test.pdf" with acrobat DC, it turns out to be normal.

test.zip

izuzak commented 7 years ago

Thanks for opening an issue. Strange, I see the image just fine:

screen shot 2017-05-03 at 08 17 45

Can you share a screenshot of what you see and some more helpful information, like which version of Atom and this package you're using, which OS and version, whether the image shows up when you zoom in or out? Happy to reopen this once that information is provided

zpxzgh commented 7 years ago

Atom 1.16.0 x64 pdf-view 0.57.0 OS: windows10 10.0

Thank you for your reply! I think maybe you misunderstood my problem. There's no problem opening "a.pdf" or "a.eps", "a.pdf" is just a intermediate product from "a.vsdx" to "a.eps". ''a.eps" is the only figure used in "test.tex". The problem is that after building "test.tex", "a.eps" doesn't show up in "test.pdf", and the whole page where "a.eps" should be turns out to be blank. The image doesn't show up in "test.pdf" when I zoom in or out. But in acrobat DC, it turns out to be normal.

Here's my screenshot screenshot

izuzak commented 7 years ago

I think maybe you misunderstood my problem.

I didn't misunderstand your problem, it's just that you didn't provide the actual pdf with which you're reproducing the problem. The test.zip archive which you provided contains a.pdf, but not test.pdf. Can you provide test.pdf as well? Thanks.

zpxzgh commented 7 years ago

I appologize for my miatake, and thanks for your patience. test.pdf

izuzak commented 7 years ago

Thanks! :bow: I'm able to reproduce the problem now.

The problem doesn't manifest in pdf.js, the library on top of which package was built: https://mozilla.github.io/pdf.js/. I think that means that this package isn't doing something that it should be doing to handle this situation. I'm not sure what that is, though -- this package doesn't do anything special: it just reads bytes from the file, gives them to pdf.js, and tells pdf.js where to render those bytes.

I won't have time to look into this problem in the near future, but if you or someone else wants to take a look and make a pull request to address this -- I'd be happy to review it. :+1:

zpxzgh commented 7 years ago

Thank you for your effort!

zpxzgh commented 7 years ago

Hello, I'm back again with the solution~(but still don't know why)

Sorry for disturbing you again, but I want to share my solution in case other people come up with the same problem.

Eps files generated by other methods like matlab performs well, and inserting a pdf file as an image works too, so the problem must be in the conversion from pdf to eps. Practice proves that my guess is correct, and here's my solution:

when saving as a pdf to a eps file, click the settings button image

Then choose Color Management image

change Color Handling from default to others(both are OK for me, except the default one) image

Then click OK to save the settings and save the eps file.

The eps file generated does show up in pdf-view.

Hope this could help others who come up with the same problem.

izuzak commented 7 years ago

Thanks for investigating and posting your findings, @zpxzgh ✨. I hope that will be helpful to others as well. I'll keep this issue open for now -- it would be great if such workarounds weren't needed, so perhaps this can be fixed in this package itself.