Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:52:33+00:00 2026-06-02T18:52:33+00:00

I need to extract video file which is embedded in pdf file. i could

  • 0

I need to extract video file which is embedded in pdf file. i could find the video which is in annotation so that i can’t save it separately. i need to save this file how do i achieve this?

Ex:
iTextSharp – how to open/read/extract a file attachment?

he has extracted attachement like the way i need to extract the video.

here is my code:

 string FileName = AppDomain.CurrentDomain.BaseDirectory + "raven test.pdf";
    PdfReader pdfreader = new PdfReader(FileName);
    PdfDictionary PageDictionary = pdfreader.GetPageN(1);
    PdfArray Annots = PageDictionary.GetAsArray(PdfName.ANNOTS);       
    if ((Annots == null) || (Annots.Length == 0))
        return;

    foreach (PdfObject oAnnot in Annots.ArrayList)
    {
        PdfDictionary AnnotationDictionary = (PdfDictionary)PdfReader.GetPdfObject(oAnnot);

        if (AnnotationDictionary.Get(PdfName.SUBTYPE).Equals(PdfName.RICHMEDIA))
        {
            if (AnnotationDictionary.Keys.Contains(PdfName.RICHMEDIACONTENT))
            {
                PdfDictionary oRICHContent = AnnotationDictionary.GetAsDict(PdfName.RICHMEDIACONTENT); // here i could see the video embeded but it is in annotation, how do i save this file?
            }
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:52:35+00:00Added an answer on June 2, 2026 at 6:52 pm

    For this one you’ll want to reference the Adobe Supplement to ISO 32000, BaseVersion 1.7, ExtensionLevel 3 official spec. Below is the basic code although you’ll probably want to throw in some more null checks. See the comments for any questions. Just a note, not all embedded movies use the RichMedia format, some are just special attachments so this won’t get them all.

    PdfReader pdfreader = new PdfReader(FileName);
    PdfDictionary PageDictionary = pdfreader.GetPageN(1);
    PdfArray Annots = PageDictionary.GetAsArray(PdfName.ANNOTS);
    if ((Annots == null) || (Annots.Length == 0))
        return;
    
    foreach (PdfObject oAnnot in Annots.ArrayList) {
        PdfDictionary AnnotationDictionary = (PdfDictionary)PdfReader.GetPdfObject(oAnnot);
    
        //See if the annotation is a rich media annotation
        if (AnnotationDictionary.Get(PdfName.SUBTYPE).Equals(PdfName.RICHMEDIA)) {
            //See if it has content
            if (AnnotationDictionary.Contains(PdfName.RICHMEDIACONTENT)) {
                //Get the content dictionary
                PdfDictionary RMC = AnnotationDictionary.GetAsDict(PdfName.RICHMEDIACONTENT);
                if (RMC.Contains(PdfName.ASSETS)) {
                    //Get the assset sub dictionary if it exists
                    PdfDictionary Assets = RMC.GetAsDict(PdfName.ASSETS);
                    //Get the names sub array.
                    PdfArray names = Assets.GetAsArray(PdfName.NAMES);
                    //Make sure it has values
                    if (names.ArrayList.Count > 0) {
                        //A single piece of content can have multiple assets. The array returned is in the form {name, IR, name, IR, name, IR...}
                        for (int i = 0; i < names.ArrayList.Count; i++) {
                            //Get the IndirectReference for the current asset
                            PdfIndirectReference ir = (PdfIndirectReference)names.ArrayList[++i];
                            //Get the true object from the main PDF
                            PdfDictionary obj = (PdfDictionary)PdfReader.GetPdfObject(ir);
                            //Get the sub Embedded File object
                            PdfDictionary ef = obj.GetAsDict(PdfName.EF);
                            //Get the filespec sub object
                            PdfIndirectReference fir = (PdfIndirectReference)ef.Get(PdfName.F);
                            //Get the true file stream of the filespec
                            PRStream objStream = (PRStream)PdfReader.GetPdfObject(fir);
                            //Get the raw bytes for the given object
                            byte[] bytes = PdfReader.GetStreamBytes(objStream);
                            //Do something with the bytes here
                        }
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to extract Asia from this array. How can i do that. Here
I need to extract the name of the video from the below xml. Can
I need to extract the image url from this enclosure. How can i access
I need to extract all the images from a PDF file on my server.
I need to extract all the tags from an HTML file, In such a
I need to extract data from a source that presents it in one of
I need to extract an image/thumbnail from a video hosted on some website. For
I need to extract words that contain digits. ex:- Input - 3909B Witmer Road.
Looking for solution to extract content from a PDF file (using console tool or
I need to extract the audio from a FLV file recorded using FMS. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.