Adding a sound via a plugin is not an easy task - assuming you're not creating legacy content (which is disabled for playback in the current versions of Adobe Reader) then you have to create a new rich media annotation via an extension of the PDAnnot class, assign the sound data as a COS stream for the annotation and embed a Flash player widget and associated control code to actually play the sound file when the PDF is viewed. Very little of this is documented in the SDK, so the usual advice I give people is to do the same thing using the Acrobat UI on a blank PDF, save the PDF in uncompressed form (for example using Snippet Runner), and inspect the tags in a text editor. Your code must then be written so that it recreates exactly the same tag structure.
For more help, you should ask your question in the Acrobat SDK forum rather than here, as it's not related to JavaScript.Note that the SDK is written in C++.
Actually, the old JavaScript Sound object works just great in Acrobat X. Look this one up in the Acrobat JavaScript Reference. From a file format perspective this is a very simple object to add to the PDF. Its a single entry in the Name Tree. And it is very simple to use from either JavaScript or a button action.
The question is, "What do you mean by using C#?" A .Net application on the desktop can communicate with Acrobat through the IAC interface. In this case you could write a program in C# that calls JavaScript functions in Acrobat to import a sound object. Although VB.Net would be a better choice.
If you want to write a program that works independently of Acrobat, for example a server script. Then you'll need a PDF Library that will will work with C#. There are plenty. Look up PDF.Net, QuickPDF, and iText. Just to name a few.
Thanks guys for your help. I try to create a sound annotation using javascript annotation. Here is the sample code ' Create a new sound annot annot = jso.AddAnnot props = annot.getProps props.Type = "Sound" annot.setProps(props) ' Fill in a few fields props = annot.getProps props.page = 0 props.point = point props.rect = popupRect props.author = "John Doe" props.soundIcon = "Speaker" props.strokeColor = jso.Color.red Dim sre As String = "C:\AmitSaini\SandBox\PDFWithAudio\PDFWithAudio\123.wav" props.Contents = sre annot.setProps(props)
This code just create a sound icon on PDF but that icon does not play anything. Please guide where i am doing mistake?
For more help, you should ask your question in the Acrobat SDK forum rather than here, as it's not related to JavaScript.Note that the SDK is written in C++.