开发者

Speech-Over PDF?

开发者 https://www.devze.com 2023-01-06 18:56 出处:网络
I\'d like to add speech-over/narration to a PDF document. 开发者_如何学编程 So a sentence is highlighted (background color or text color changes) and the synced audio (not a computer voice but a reco

I'd like to add speech-over/narration to a PDF document.

开发者_如何学编程

So a sentence is highlighted (background color or text color changes) and the synced audio (not a computer voice but a recorded audio clip) plays. How do I do it? Are there readymade software available (on mac preferably) to achieve this?

I'd appreciate any help.

Thanks


Tricky problem. A few years ago, I'd say that the only way to do this is with a plug-in to Acrobat as that was really the only API that could manage this.

Today, I think the way you want to do this is to create highlight annotations for each sentence. Then create a widget annot that has a series of javascript actions that change the opacity of the sentences then trigger a sound annot to play.

Something like this in pseudo-code

foreach sentenceAnnot,sentenceSoundAnnot do
    set sentenceAnnot.opacity to 1
    play sentenceSoundAnnot
    set sentenceAnnot.opacity to 0

Now this is going to stink as a process - writing any kind of scripts for annotation actions stinks since the editor and debugger are cruel jokes. Start by getting a copy of the acrobat javascript api reference. You'll be dead without it.

Then you have to figure out how to author the action that you want. Here is a script that I put into an action on a link to change the opacity of all highlights on page 0 to half:

var annots = this.getAnnots({nPage:0});

for (var i =0; i < annots.length; i++) {
   if (annots[i].type = "Highlight")

   annots[i].opacity = 0.5;
}

This can be easily modified to find a specific annotation on the page. You're supposed to be able to find them by name via the getAnnot method, but I saw nothing that would indicate how to set the name property of an annot in the Acrobat UI - so good luck authoring that. You'll probably have to get by setting the highlight subject to something identifiable that you can then get. You would also put sounds on the page and then play those.

0

精彩评论

暂无评论...
验证码 换一张
取 消