Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not determine PDF size" #2350

Closed
sjackman opened this issue Aug 6, 2015 · 10 comments
Closed

"Could not determine PDF size" #2350

sjackman opened this issue Aug 6, 2015 · 10 comments

Comments

@sjackman
Copy link

sjackman commented Aug 6, 2015

I'm rendering Markdown to DOCX, and I'm seeing the error could not determine PDF size. Both Mac OS and ImageMagick report that the PDF size is 522 x 504 pt (7.25 x 7 in). I can send you the PDF, if it's helpful. @github issues unfortunately don't allow uploading PDF.

❯❯❯ make docx
pandoc --filter=pandoc-citeproc -o white-spruce-organelles.docx white-spruce-organelles.md
pandoc: Could not determine image size in `figure/mt-gene-order.pdf': could not determine PDF size
❯❯❯ identify figure/mt-gene-order.pdf
figure/mt-gene-order.pdf PDF 522x504 522x504+0+0 16-bit Bilevel Gray 33.3KB 0.000u 0:00.000
❯❯❯ pandoc --version
pandoc 1.15.0.6
@jgm
Copy link
Owner

jgm commented Aug 6, 2015

Please put the PDF somewhere and link to it so we can have a look.

+++ Shaun Jackman [Aug 06 15 12:36 ]:

I'm rendering Markdown to DOCX, and I'm seeing the error could not
determine PDF size. Both Mac OS and ImageMagick report that the PDF
size is 522 x 504 pt (7.25 x 7 in). I can send you the PDF, if it's
helpful. [1]@github issues unfortunately don't allow uploading PDF.
❯❯❯ make docx
pandoc --filter=pandoc-citeproc -o white-spruce-organelles.docx white-spruce-org
anelles.md
pandoc: Could not determine image size in `figure/mt-gene-order.pdf': could not
determine PDF size
❯❯❯ identify figure/mt-gene-order.pdf
figure/mt-gene-order.pdf PDF 522x504 522x504+0+0 16-bit Bilevel Gray 33.3KB 0.00
0u 0:00.000
❯❯❯ pandoc --version
pandoc 1.15.0.6


Reply to this email directly or [2]view it on GitHub.

References

  1. https://github.com/GitHub
  2. "Could not determine PDF size" #2350

@sjackman
Copy link
Author

sjackman commented Aug 6, 2015

@jgm
Copy link
Owner

jgm commented Aug 7, 2015

I noticed this in Text.Pandoc.ImageSize:

   Just Pdf  -> Left "could not determine PDF size" -- TODO

which accounts for what you're seeing. Just need to write
the code for extracting image size from the PDF. Or maybe
the JuicyPixels library will help with that.

+++ Shaun Jackman [Aug 06 15 13:19 ]:

[1]https://www.dropbox.com/s/y99j939woc2vpaw/mt-gene-order.pdf


Reply to this email directly or [2]view it on GitHub.

References

  1. https://www.dropbox.com/s/y99j939woc2vpaw/mt-gene-order.pdf
  2. "Could not determine PDF size" #2350 (comment)

@sjackman
Copy link
Author

sjackman commented Aug 7, 2015

For now I've converted the PDF to PNG.

brew install imagemagick
convert -units PixelsPerInch -density 600 fig.pdf fig.png

@mb21 mb21 changed the title Rendering Markdown to DOCX: could not determine PDF size "Could not determine PDF size" Jan 17, 2017
@nsheff
Copy link

nsheff commented May 4, 2018

Hi, just wanted to follow-up on this. I'm having the same symptom as in #2381 -- markdown-included PDFs render fine in PDF output, but docx output shows "Read-error". Since it's been a few years since any comments on this thread I just wanted to see if there are any alternative recommendations at this point, or if it's still just pending "code for extracting image size from the PDF".

@mb21
Copy link
Collaborator

mb21 commented May 4, 2018

This issue was actually fixed by eeafb3f

@nsheff It's not possible to include PDFs in docx files.

@mb21 mb21 closed this as completed May 4, 2018
@bogdanni
Copy link

It is possible though:
https://support.office.com/en-us/article/Add-a-PDF-to-your-Office-file-74819342-8F00-4AB4-BCBE-0F3DF15AB0DC

Word for Mac can display PDF figures in docx produced by pandoc (2.2.1), albeit the size (or at least the aspect ratio) appears wrong. Word for Windows doesn't display those figures.

Attempting to output to ODT produces this warning ([WARNING] Could not determine image size for '...pdf': could not determine PDF size).

@mb21
Copy link
Collaborator

mb21 commented May 31, 2018

@bogdanni, interesting! If you could post a minimal docx file that embeds a PDF and works cross-platform (also for a bit older Word versions) to #2061, that would be great. (Or even better, also the XML snippet responsible...)

@bogdanni
Copy link

The bad news is that Word for both Mac and Windows convert the PDF on insert into EMF. The attached is made with Word for Mac 16.15.
pdf_mac.docx

@mb21
Copy link
Collaborator

mb21 commented May 31, 2018

Ah, so it's not actually embedding the PDF. I guess image conversion is currently out of scope for pandoc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants