Recover an Embedded Image

By now I’ve mentioned a bunch of times that it is better to link your images than to embed them.  Most notably in this blog entry.  Just to review the facts one more time:

  • Linked/embedded applies only to the form definition (the template). By the time you generate a PDF, the image is always embedded in the PDF.  But the mechanics of how it is embedded in the PDF differs from embedded to linked.
  • Images embedded in the template are stored in base64 format.  Linked images are stored in binary form.  Base64 is 4/3 bigger than binary
  • Embedded images cause very large form templates. Linked images are stored outside the form template.
  • Embedded images force Designer and Reader to keep the image in DOM memory, resulting in slower open times, higher memory footprint, slower performance in Reader and Designer
  • Same embedded image used <n> times is stored <n> times.  Same linked image used <n> times is stored once

Now, just in case all of that rationale was a bit too much tech-speak (what’s a DOM anyway?) let me simplify the message: Do not embed images in your templates. When you see this pallette, do not check the box.

Lost Images

I predict some of you will look at your forms and realize that you no longer have the original image that you embedded in your template.  It is possible to recover these images and extract them to an external file.  The process is a bit messy, but if you really need it, I’m sure you can figure it out.  Here are the steps:

  1. Find a web site that supports base64 decoding.  A google search for "base64 decode" led me to this site:
  2. In Designer, select the image object and then switch to XML source view.  Make note of the contentType.  In the example below, it is image/JPG.  This will tell you what file suffix to use when you download the file.
  3. Copy the base64 image data into your paste buffer.  i.e. select the base64 data and right-click to choose "Copy"
  4. Go to the web site and paste into the "Base64 to Decode" field.  Click the "Process now" button.
  5. Now click the "download binary file now" button.  Save the file using a suffix according to the content type — in this case, with a .jpg extention.

Once you have the image extracted, go back to your form design, re-specify the url to the new image and de-select the embed option.  This would be a great tool to develop into a Designer macro.  Especially given that mx.utils has a Base64Decoder class.

4 Responses to Recover an Embedded Image

  1. radzmar says:

    Hi John,

    this is an actual topic of myself too.
    I’m trying a similar approach, where I save the images from the image fields as attachments which than can be save to the hard drive.
    This method is pretty handy and user-friedly I think.

    var Number = “0”;
    if ( !== null)
    Number =;

    var fileExtension = ImageField1.value.image.contentType.replace(“image/”, “.”);
    var b64Data = ImageField1.value.image.value;
    var ReadStream = util.streamFromString(b64Data);
    var DecodedStream = Net.streamDecode(ReadStream, “base64”);
    var NewAttachmentName = “MyExportImage_” + Number + fileExtension;, “”, “image/png”);, DecodedStream); = {overViewMode:7};

    But, of course it has a snag.
    The export is only partially if the image is greater than ~50kb.
    This is a sadly a kink of the streamDecode function in Acrobat.

    Anyway, I’m happy that you posted another way I can deal with ;-)

  2. Radzmar:
    Of course, I’d probably argue that form images should never be greater than 50K…
    Glad you find the alternative useful.


  3. radzmar says:

    Hi John,

    as follow-up on this topic I designed a macro to export the embedded images directly which makes things easier.