-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
LaTeX writer: embedding pdf and video files #7181
Comments
For html output, this already works (perhaps this could be better documented):
But not for LaTeX/PDF output AFAIK... |
Ohh that's awesome, but can you reference the pages/timestamps? |
After trying it out, it seems like it does!
This still opens the pdf at the correct page. |
@juligreen you said:
This is not undesirable, quite the contrary, embedding videos in PDF would be useful just like embedding images in PDF. |
Though regarding video files, while it works correctly with ".mov" and ".mp4" files, ".mkv" get incorrectly recognized as images
|
yeah, I guess we could add mkv here... and/or make a pull to happstack where we get that list from. About adding support of videos to the default LaTeX template, I think if it requires uncommon packages, then we would not want to do that... as you can simply use a custom template if you need to... |
Right now, I am able to embed the first page of a pdf with the image syntax, however I cannot specify the page. I think an easy way to implement pdf page embedding would be to pass the attribute https://pandoc.org/MANUAL.html#extension-link_attributes So that a specific pdf page could be embedded this way:
Right now I am able to achieve what I want by putting in the raw latex command directly, but that comes at the cost of simple captioning. Plus, the
|
So you can specify |
These are actually supported by `\includegraphics`, though this is not well documented. See https://tex.stackexchange.com/questions/7938/pdflatex-includegraphics-and-multi-page-pdf-files Partially addresses #7181.
Just as a heads up, I think the mime-type of mkv is still not correctly set as mentioned here: #7181 (comment) |
What should the mime type of .mkv be? |
@jgm Wikipedia says |
So the answer to that is not super easy. Firefox and Safari are the only browsers without mkv support currently (though I'm not even certain about Safari) <p><video src="test.mkv" controls=""><a href="test.mkv">Video</a></video></p> This plays without problems in chromium-based browsers, but shows the following for Firefox: But it doesn't end there since mkv can hold any kind data inside which is especially problematic with some video and audio codecs, since they don't play at all in most browsers (the ones that work will show, the ones that don't will not, so you can have audio playing without video for example). Btw adding Even with all my ramblings here, I think the option should still be given to the user to embed mkv files if they know that they are compatible (and I pray for Firefox support in the meantime). The thing I actually want is |
Thanks for the investigation! Adding |
I'm reading the discussion above, and including video in pdfs appears to be supported. grep PRETTY /etc/*release
/etc/os-release:PRETTY_NAME="Ubuntu 20.04.5 LTS"
wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-linux-amd64.tar.gz
tar zxf pandoc-2.19.2-linux-amd64.tar.gz
# Download a CC -BY licensed video https://www.eso.org/public/videos/eso2207a/
wget https://cdn.eso.org/videos/medium_podcast/eso2207a.mp4
file eso2207a.mp4
eso2207a.mp4: ISO Media, Apple iTunes Video (.M4V) Video
echo '![](eso2207a.mp4)' > test.md
./pandoc-2.19.2/bin/pandoc test.md -o test.pdf
[WARNING] Could not convert image /tmp/tex2pdf.-eabaa3f94a509656/eso2207a.mp4: Cannot load file
Jpeg Invalid marker used
PNG Invalid PNG file, signature broken
Bitmap Invalid Bitmap magic identifier
GIF Invalid Gif signature : ft
HDR Invalid radiance file signature
Tiff Invalid endian tag value
TGA Width is null or negative
Error producing PDF.
! LaTeX Error: Unknown graphics extension: .mp4.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.68 ...mp/tex2pdf.-eabaa3f94a509656/eso2207a.mp4}
|
Hey! :)
I'm trying some things out to create a workflow with pandoc markdown that is similar to org-noter.
This means I want to reference locations inside of pdfs (and later video files as well) inside my documents.
This is already somewhat possible by using html and latex directly inside of markdown:
I put a backslash in front of the triple backticks so they don't break the code block.
After converting this markdown document into pdf, it embeds pages 2-3 from the loremipsum.pdf into the newly generated pdf.
output.pdf
The generated html has the complete pdf embeded, but starts at page 2.
output.html:
loremipsum.pdf
This part:
<p>Referenced pages 2-3: <a href="loremipsum.pdf">Download PDF</a>.</p>
only gets displayed in case the browser does not support embedded pdfs.Now I would like to have some syntax in pandoc markdown that can generate each of these blocks for their respective filetypes.
I would imagine the syntax to be something like this:
!embed[pdf-title](loremipsum.pdf:2-3)
Or anything like it.
A similar thing might be possible for embedding video files in html:
And you even might be able to include these in pdf, but that might be undesireable.
If this is a stupid idea, feel free to close this issue 👋
The text was updated successfully, but these errors were encountered: