Hi Michal and Hans, many thanks for your patch to fix multimedia objects in PDF and your extremely interesting and in-depth explanation about multimedia in PDF. Many thanks to Hans for the release of an updated latest with also updated documentation. Although I don’t read Czech, just out of curiosity, is your bachelor thesis available on the net, Michal? Thanks to theses.cz, I found https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name coincidence, I guess). Using your sample, I have two questions: \starttext \setupinteraction[state=start] \useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes] \definerenderingwindow[myrenderingwindow] [width=\textwidth, height=\textwidth] \placerenderingwindow[myrenderingwindow][myvideo] \stoptext Is there no way to have the video as an embedded file in the PDF document? (I mean, that the file is listed when the attachment panel is displayed.) The second question is addressed to Hans: would it be possible that \placerenderingwindow could have another option and text as in \framed? A workaround would be to add a layer, but too complex only for adding usage instructions for the media usage. Many thanks for your help, Pablo -- http://www.ousia.tk
On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
Hi Michal and Hans,
many thanks for your patch to fix multimedia objects in PDF and your extremely interesting and in-depth explanation about multimedia in PDF. Many thanks to Hans for the release of an updated latest with also updated documentation.
Although I don’t read Czech, just out of curiosity, is your bachelor thesis available on the net, Michal? Thanks to theses.cz, I found https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name coincidence, I guess).
Sorry, should have shared the link at the first place. https://dspace.cvut.cz/handle/10467/95065 (PLNY_TEXT) links to the full text. (PRILOHA) is almost all files I had for the thesis. Most notably the testing files I used. (Some were handcoded, so no sources, but these should be readable in text editors).
Using your sample, I have two questions:
\starttext \setupinteraction[state=start]
\useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes]
\definerenderingwindow[myrenderingwindow] [width=\textwidth, height=\textwidth]
\placerenderingwindow[myrenderingwindow][myvideo] \stoptext
Is there no way to have the video as an embedded file in the PDF document? (I mean, that the file is listed when the attachment panel is displayed.)
Currently, only attachments are added as "embedded files" (either as "hidden", ending up in /EmbeddedFiles, or as "annotation" ending up as /FileAttachment annotation). Maybe "codeinjections.embedfile" can have the option to force the reference, so that the file also ends up in /EmbeddedFiles? Should it be default for all \externalrenderings? My try: https://github.com/contextgarden/context-mirror/commit/681c36d0ecfd30c05ed58... (the full file can be located by clicking on the three dots after the file name, then "View file" and then "Raw", resulting in: https://github.com/contextgarden/context-mirror/blob/681c36d0ecfd30c05ed588e..., Patch can be obtained by adding .diff to the URL: https://github.com/contextgarden/context-mirror/commit/681c36d0ecfd30c05ed58... I will probably not keep the commit on GitHub forever, it just seems like a nice way to send quick patches -- it is visual and allows full file/patch download. So this time full patch also included below for future reference.) Michal --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt @@ -259,7 +259,7 @@ local function flushembeddedfiles() for tag, reference in sortedhash(filestreams) do if not reference then report_attachment("unreferenced file, tag %a",tag) - elseif referenced[tag] == "hidden" then + elseif referenced[tag] == "hidden" or referenced[tag] == "forced" then e[#e+1] = pdfstring(tag) e[#e+1] = reference -- already a reference f[#f+1] = reference -- collect all file description references @@ -369,6 +369,9 @@ function codeinjections.embedfile(specification) } local r = pdfreference(pdfflushobject(d)) filestreams[hash] = r + if specification.forcereference == true then + referenced[hash] = "forced" + end return r end end @@ -705,9 +708,10 @@ local function insertrendering(specification) descriptor = pdfreference(pdfflushobject(descriptor)) elseif option[v_embed] then descriptor = codeinjections.embedfile { - file = filename, - mimetype = mimetype, -- yes or no - compress = false, + file = filename, + mimetype = mimetype, -- yes or no + compress = false, + forcereference = true, } end local clip = pdfdictionary {
On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
Hi Michal and Hans,
many thanks for your patch to fix multimedia objects in PDF and your extremely interesting and in-depth explanation about multimedia in PDF. Many thanks to Hans for the release of an updated latest with also updated documentation.
By the way, Pablo, your issue https://www.mail-archive.com/ntg-context@ntg.nl/msg88204.html was also solved in the last upload. Unfortunately it will probably not help you, because Acrobat no longer supports this. \useexternalsoundtrack [myaudio][audio.mp3] \checksoundtrack{myaudio} \goto{PLAY SOUND}[StartSound{myaudio}] But, you can use renderings instead: \useexternalrendering[myaudiorendering] [audio/mp3][audio.mp3][embed=yes] \definerenderingwindow[audiowindow] [width=0sp, height=0sp] \definelayer[resources] \setupbackgrounds[page][background=resources] \setlayer[resources]{\placerenderingwindow[audiowindow][myaudiorendering]} \goto{PLAY SOUND}[StartRendering{myaudiorendering}] This is basically the example from "/back-swf.mkiv". Works in Acrobat. And one can use either of the three possible file methods (embedded, external, URL), not just external files. The layer is so that the empty frame doesn't interfere with normal page content. No frame is drawn when both dimensions are 0, not sure if that is a behaviour one can take as granted. But currenntly the dimensions can't be zero. Hans, I would omit the check for 0 dimensions of rendering window (as already noted in the source, it is useful for sound). See patch below. Michal Vlasák --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt @@ -655,9 +655,6 @@ local function insertrenderingwindow(specification) } local width = specification.width or 0 local height = specification.height or 0 - if height == 0 or width == 0 then - -- todo: sound needs no window - end context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref return pdfreference(r) end
On 7/30/21 11:57 PM, Michal Vlasák via ntg-context wrote:
On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
[...] Although I don’t read Czech, just out of curiosity, is your bachelor thesis available on the net, Michal? Thanks to theses.cz, I found https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name coincidence, I guess).
Sorry, should have shared the link at the first place.
Many thanks for your fast reply and the link to your thesis, Michal.
[...] Is there no way to have the video as an embedded file in the PDF document? (I mean, that the file is listed when the attachment panel is displayed.)
Currently, only attachments are added as "embedded files" (either as "hidden", ending up in /EmbeddedFiles, or as "annotation" ending up as /FileAttachment annotation).
Maybe "codeinjections.embedfile" can have the option to force the reference, so that the file also ends up in /EmbeddedFiles? Should it be default for all \externalrenderings? [...] --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt [...]
Many thanks for the patch. It would be also great to have an option not to list some files as embedded (adding a option "list" to "\useexternalrendering" such as in "\useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes, list=no]"). Being the default to yes, I’m thinking of cases where there is a risk distributing the multimedia file without the embedding document, because of the lack of context (no pun indented) Many thanks for your help, Pablo -- http://www.ousia.tk
On 7/31/21 1:08 AM, Michal Vlasák via ntg-context wrote:
[...] By the way, Pablo, your issue https://www.mail-archive.com/ntg-context@ntg.nl/msg88204.html was also solved in the last upload. Unfortunately it will probably not help you, because Acrobat no longer supports this. [...] But, you can use renderings instead:
\useexternalrendering[myaudiorendering] [audio/mp3][audio.mp3][embed=yes]
\definerenderingwindow[audiowindow] [width=0sp, height=0sp]
\definelayer[resources] \setupbackgrounds[page][background=resources] \setlayer[resources]{\placerenderingwindow[audiowindow][myaudiorendering]}
\goto{PLAY SOUND}[StartRendering{myaudiorendering}]
This is basically the example from "/back-swf.mkiv". Works in Acrobat. And one can use either of the three possible file methods (embedded, external, URL), not just external files. The layer is so that the empty frame doesn't interfere with normal page content. No frame is drawn when both dimensions are 0, not sure if that is a behaviour one can take as granted. But currenntly the dimensions can't be zero.
Many thanks for your code update, Michal. I’m extremely interested in investigating the possibilities this opens. But I’m afraid that I will have other things to do first. It will take me months to come back to this again.
Hans, I would omit the check for 0 dimensions of rendering window (as already noted in the source, it is useful for sound). See patch below.
Many thanks for the patch and for your help, Pablo -- http://www.ousia.tk
participants (2)
-
Michal Vlasák
-
Pablo Rodriguez