Skip navigation
Currently Being Moderated

CS5- Custom Links to EPS Files Don't Work?

Sep 15, 2011 10:13 AM

I am building a plugin that allows a user to place graphic assets from our own external asset management system into their InDesign document.  These assets need to maintain a "custom link" to the external assets.

 

Everything was working great for simple raster image formats (like JPEG) but the custom link information seems to get lost for EPS files.

 

After doing some deep debugging I decided to try building one of the sample plugins that ship with CS5 - 'customdatalink' and the accompanying 'customdatalinkui'.  This sample does a similar type of thing with CSV files that reference external assets.

 

To make a long story short, the sample plugin exhibits the exact same behavior.  If you edit one of the sample csv files to point to an EPS image and place that in a document, you'll see that the Link URI is replaced with a file:// style path instead of the custom csv:// URI.  It works as expected for JPEG files.

 

Surely this is not expected behavior.  Am I missing something obious here or is this a simple (but pretty major for my plugin) bug?

 

Thanks in advance for any assistance.

 

p.s. this behavior is identical on both Mac and Windows.

 
Replies
  • Currently Being Moderated
    Sep 21, 2011 6:42 AM   in reply to Shigli

    I'm having the same problem with my datalink plugin. Only the EPS files are giving problems. Did you find a workaround or solution for this problem already?

     

    If I come up with something I'll post it here!

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2011 4:42 AM   in reply to Shigli

    I had this problem too with CS4 and I assume that it's the same with CS5. It's complicated why it happens to EPS files but it's because the weird way the EPS importer works. If I remember correctly it's because the importer sees that the IPMStream boss includes an IID_IFILESTREAMDATA and creates it's own link resource. The link then ends up with 2 link resources.

     

    You will need to change your ILinkResourceHandler::CreateResourceReadStream to return your own IPMStream when dealing with EPS files. I know it's wacked but what about custom links, especially handling InCopy files, isn't..? You can just make your stream a proxy for a real IPMStream and since your stream dosen't include an IID_IFILESTREAMDATA you won't get the double link resource issue.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 12, 2011 3:27 AM   in reply to Doug.Norton

    Wauw thanks! This really helped! In stead of the CreateFileStreamReadLazy I used the CreatePointerStreamRead and passed a pointer to the image in memory. This works great for EPS files. I never expected the IID_IFILESTREAMDATA to give those problems ... I'm very glad this solved it for me.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 12, 2011 11:47 AM   in reply to Shigli

    Here's a bit more detail. Again the idea is to return an IPMStream that doesn't include a IID_IFILESTREAMDATA. So I make a proxy IPMStream that just forwards requests to a real IPMStream.

     

    I've abbreviated a bit here for space reasons.

     

    So I make my own IPMStream object adding the class to my .fr file:

     

    class FileProxyWriteStream : public CPMUnknown<IPMStream>

    {

    public:

     

                   FileProxyWriteStream(IPMUnknown* boss);

              virtual     ~FileProxyWriteStream();

     

              void SetRealStream(IPMStream *, AeInDesignGeo *);

     

              virtual uchar XferByte(uchar& chr) { return mRealStream->XferByte(chr); }

     

    ... all IPMStream methods

    };

     

    Create my proxy stream:

     

    proxyStream = ::CreateObject2<IPMStream>(kFileProxyWriteStreamBoss, IID_IPMSTREAM);

     

    And I create a IPMStream:

     

    InterfacePtr<IPMStream>          realStream(StreamUtil::CreateFileStreamReadLazy(file, kOpenIn));

     

    Tell my proxyStream about the realStream

     

    proxyStream->SetRealStream(proxyStream);

     

    and CreateResourceReadStream returns my proxyStream

     

    Hope this helps

    -doug

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 14, 2011 9:14 AM   in reply to Doug.Norton

    This method does look better than mine, and just a littlebit extra work. So I changed it, and it works fine! Only had to add .forget() to the stream for it not to crash...

     

    Thanks again :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2011 4:47 AM   in reply to Shigli

    I only use the proxy stream when I'm dealing with EPS files otherwise, yeah, INCD files can't be read. Another annoyance but what part of custom links, especially dealing with INCD links, aren't...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points