Skip to main content
Participating Frequently
September 15, 2011
Answered

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

  • September 15, 2011
  • 4 replies
  • 3870 views

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.

This topic has been closed for replies.
Correct answer Doug_Norton

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.

4 replies

Inspiring
October 19, 2011

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...

Inspiring
October 12, 2011

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

Participant
October 14, 2011

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 :-)

Doug_NortonCorrect answer
Inspiring
October 6, 2011

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.

Participant
October 12, 2011

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.

Participant
September 21, 2011

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!

ShigliAuthor
Participating Frequently
September 26, 2011

I'm afraid not.  I'm still stuck on this one...