Skip to main content
Participant
March 14, 2006
Question

IndesingCS2 server scriptable pluign: how to import image file into a frame.?

  • March 14, 2006
  • 12 replies
  • 1445 views
Hello<br />I am creating a scriptable pluign for indesingcs2 server.<br />Now I am stuck at importing a image file in a image frame on a document.<br />The code which was running fine for indesingcs2 desktop is given below.<br />//////////////////////////////////////////////////////////////////////////////////////////////////<br /> IDFile sysFile = SDKUtilities::PMStringToSysFile(const_cast<PMString* >(&ImageFileNamewithcompletepath)); <br /> InterfacePtr<ICommand> importCmd(CmdUtils::CreateCommand(kImportAndLoadPlaceGunCmdBoss));<br /> if(!importCmd) <br /> return kFalse; <br />InterfacePtr<IImportFileCmdData> importFileCmdData(importCmd, IID_IIMPORTFILECMDDATA); <br /> if(!importFileCmdData)<br /> return kFalse;<br /><br /> <br /><br /> //db is input.I got it using the techniques mentioned in the indesign-server-plugin-techniques.pdf<br /> //page 18..<br /> importFileCmdData->Set(db, sysFile, kMinimalUI);<br /> ErrorCode err = CmdUtils::ProcessCommand(importCmd);<br /> if(err != kSuccess) <br /> return kFalse;<br /><br /> InterfacePtr<IPlaceGun> placeGun(db, db->GetRootUID(), UseDefaultIID());<br /> if(!placeGun)<br /> return kFalse;<br /><br /> <br /> UIDRef placedItem(db, placeGun->GetItemUID());<br /><br /> InterfacePtr<ICommand> replaceCmd(CmdUtils::CreateCommand(kReplaceCmdBoss));<br /> if (replaceCmd == nil)<br /> return kFalse;<br /><br /> InterfacePtr<IReplaceCmdData>iRepData(replaceCmd, IID_IREPLACECMDDATA);<br /> if(!iRepData)<br /> return kFalse;<br /> <br /> iRepData->Set(db, imageBox.GetUID(), placedItem.GetUID(), kFalse);<br /><br /> ErrorCode status = CmdUtils::ProcessCommand(replaceCmd);<br /> if(status==kFailure)<br /> return kFalse;<br /><br /> return kTrue;<br />/////////////////////////////////////////////////////////////////////////////////////////////////<br />I used the same code for making scriptable plugin for indesignCS2 server as it doesn't involve use of any UI element.<br />But this code is not working.It doesn't crash or returns kFalse.<br />What i see after executing the plugin through script is a grey region for image in the graphics frame.<br /><br />I request if anyone gives me solution to this i will be highly grateful to him.<br /><br />Thanks and Regards,<br />Yogesh Joshi
This topic has been closed for replies.

12 replies

Participating Frequently
March 15, 2006
Why don't you try using IServerSettings->SetImagePreviews(kTrue)?

regards,

- mn
Participating Frequently
March 14, 2006
Actually, your code is working fine, as there are no returned errors, asserts or crashes.

The reason you are just seeing a gray box, is that the display performance is set to the lowest level in InDesign Server for performance reasons.

Hint: Open the document in "desktop" InDesign, right click on the image, and look at the Display Performance settings for the image.

See Ken Sadahiro, "[CS2 Server] Controlling display performance, how?" #1, 23 Feb 2006 8:01 am

You can of course programmatically change it to the normal or high res settings from within your plug-in, but it might slow down the performance of InDesign Server a bit.

One additional comment:
In your code where you do this:
* importFileCmdData->Set(db, sysFile, kMinimalUI);

I would do this, just to be safe:
* if (LocaleSetting::GetLocale().IsProductFS(kInDesignServerProductFS )) { importFileCmdData->Set(db, sysFile, kSuppressUI); } else { importFileCmdData->Set(db, sysFile, kMinimalUI); }