Support for embedded media files?

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Support for embedded media files?

Post by guebert »

Hallo!

From our business partners we get sometimes so called PDFs with "embedded attachments". I can see this only in Adobe Reader, but not in PDF-XChange. When will your tool support this feature?

Michael
You do not have the required permissions to view the files attached to this post.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Support for embedded media files?

Post by Ivan - Tracker Software »

Support for attachments should be added into build 42 of the viewer.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Support for embedded media files?

Post by guebert »

Is the date of release already known?

Would it be possible, to add at least a notification feature "There are embedded files inside this PDF!" in V 41.x?

Michael
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Support for embedded media files?

Post by Ivan - Tracker Software »

I'm afraid no. Build 41.4 was the last into 41.x series.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Support for embedded media files?

Post by guebert »

Ivan - Tracker Software wrote:I'm afraid no. Build 41.4 was the last into 41.x series.
That's good news, so Build 42 is about to be released soon, isn't it? :D

But ... I'm using 41.3 (not .4) and there's no update available ... ?!

Michael
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: Support for embedded media files?

Post by ugradedeveloper »

guebert wrote: Would it be possible, to add at least a notification feature "There are embedded files inside this PDF!" in V 41.x?
Michael
It is possible using Javascript to detect the existence of File or Sound attachments in a PDF even though the Viewer cannot display them. I can post the code for this if you are interested.

I can vouch that build 41.4 does exist because I am using it myself. Instead of relying on the built-in "check for updates" feature, you may need to go directly to the download page and fetch it.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Support for embedded media files?

Post by guebert »

ugradedeveloper wrote:It is possible using Javascript to detect the existence of File or Sound attachments in a PDF even though the Viewer cannot display them. I can post the code for this if you are interested.
Yes, please!

And add a how-to use this code with pdf-x-change, please.

Michael
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: Support for embedded media files?

Post by ugradedeveloper »

Michael,
The first thing you need to know is that in the Acrobat Javascript interface, sound and file attachments are treated as a type of annotation. They are identified by the "type" property of the annotation object. This will be "Sound" or "FileAttachment" respectively.

Here is the code that I use to check for annotations of a certain type in a document. The following, when passed to the RunJavaScript function, will return the number of annotations in the document:
"var annots = this.getAnnots(); var n = 0; if (annots != null) n = annots.length; n;"

The following will return the type of the first annotation in the document (remember that array indices are zero-based):
"var annots = this.getAnnots(); annots[0].type;"

This allows you to determine how many sound and/or file attachments are in a document. You could combine these two Javascript commands into a single loop that would simply break when an attachment of a particular type was found. You would then have a true/false value instead of a total count.

Lewis
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: Support for embedded media files?

Post by ugradedeveloper »

Michael,

I just noticed that you posted your question in the End Users forum and not the SDK forum. Sorry, I read both forums daily and sometimes lose track of which one I am reading. If you are not using the PDF-XChange Viewer SDK, then what I have written will probably be of no use to you. Sorry.

Lewis
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Support for embedded media files?

Post by Ivan - Tracker Software »

If you are not using the PDF-XChange Viewer SDK, then what I have written will probably be of no use to you. Sorry.
Even end-user can write and execute JavaScript into the viewer. He just need to open JavaScript console and use it (shortcut Ctrl+J).

Sample functions and their usage:

Code: Select all

function IsThereSoundOrFAOnThePage(nPage)
{
  var a = this.getAnnots(nPage);
  if (a != null)
  {
    for (i = 0; i < a.length; i++)
      if ((a[i].type == 'Sound') || (a[i].type == 'FileAttachment'))
        return true;
  }
  return false;
}

function IsThereSoundOrFAInDocument()
{
  for (i = 0; i < this.numPages; i++)
    if (IsThereSoundOrFAOnThePage(i))
      return true;
  return false;
} 

IsThereSoundOrFAInDocument();

PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.