Results 1 to 3 of 3

Thread: [02/03] assistance requested - Extract image from RTF stream

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Location
    minnesota
    Posts
    2

    [02/03] assistance requested - Extract image from RTF stream

    Has anyone extracted or fetched a image/metafile from an RTF stream. Either parse the RTF stream, or using the RichTextBox Control? I know how to insert metafiles/images, extract text, including unicode.....

    I've attempted to use rtb.control.count - this returns zero. The rtf file in question contains 28 images. These images need to be programmitcally extracted, not manually extracted.

    -david

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [02/03] assistance requested - Extract image from RTF stream

    I started working on this for you, and this is as far as I got:
    VB Code:
    1. Dim reg As New System.Text.RegularExpressions.Regex("\{\\(pict)\\(((.)|(\n))[^\}])*")
    2.         Try
    3.             For Each str As System.Text.RegularExpressions.Match In reg.Matches(Me.RichTextBox1.Rtf)
    4.                 Stop
    5.             Next str
    6.         Catch ex As Exception
    7.             Stop
    8.         Finally
    9.  
    10.         End Try
    From here, I think it gets a little more involved (determining image types, placing them into streams, attempting to export them into indiv files). This will atleast give you the encoding informtation for the images.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Location
    minnesota
    Posts
    2

    Re: [02/03] assistance requested - Extract image from RTF stream

    Thank you for your assistance. Perhaps I should have stated the problem a little more clearly.

    I do not have difficulty parsing the text from the rtf stream. ie: Searching for '\pict', finding rtf keywords, groups, etc..

    The rtf doc contains 28 images, I can find \pict 28 times, sometimes the rtf control word \metafile is found.

    Questions:
    Do you know how the \pict data terminates?
    The file in question was created with word2003. I understand word2003 writes a second set of image data for downward compatiblity with older rtf readers, do you kow how this data stream is tagged?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width