Skip navigation
Currently Being Moderated

How to open an InDesign file from CMIS repository?

Aug 23, 2012 11:30 AM

Tags: #flex #cs #indesign #sdk #cmis

We are using CS SDK 2.0 , looking to use CMIS to keep versionning of .indd file. The uss case as following:

 

  1. form our de4veloped InDesign pluging, user click a button
  2. the button will open a .indd file from cmis repository
  3. plugin check-out the file, open it within InDesign IDE
  4. user make changes
  5. user make save
  6. the plugin export a pdf and swf files from the current document, if the files exists it will update, aslo on CMIS repo to keep also versions of exported pdf and swf, if files not exist in first time .. it will create
  7. when user clos the document , it will check it in.

 

the problem there is no sufficent sample code for, even was thinking to use Adobe Drive, but there is no Adobe Drive SDK for Flex.

 

i used to fuse the sdk, but

 








private function getFileByPath(sPath:String):Fileable {




appStatus = ">> get File By Path";




message = "";




viewEnabled = false;




var request:GetObjectByPathRequest = new GetObjectByPathRequest(session);




var oFileable:Fileable;




request.path = sPath;




request.execute(onSuccess, onError);









function onSuccess (event:GetObjectByPathResponse) : void {





oFileable = event.object;











//var oDoc2:Document = new Document(event.object);











doc = event.object as Document ;











//children = new ArrayCollection(vectorToArray(event.target));





appStatus = ">> getFileByPath : Success";





viewEnabled = true;










}









return oFileable;



}







private function checkOutFile(oFile:Document):Document{









appStatus = ">> Check Out File";




message = "";




viewEnabled = false;




var request:CheckoutRequest = new CheckoutRequest(session);




request.object = doc;









var oDocument:Document;




request.execute(onSuccess, onError);







function onSuccess (event:CheckoutResponse) : void {









oDocument = event.object ;





appStatus = ">> Check Out File : Success";





viewEnabled = true;







}









return oDocument;



}

 

private function openTestFile():void {

                                        appStatus = "Open Test File";

 

                                        message = "";

                                        viewEnabled = false;

 

                                        var oFile:Fileable  = getFileByPath("/Collaboration/test.indd");

 

                                        //var oDoc2:Document = new Document(oFile);

 

                                        var oDoc:Document  = checkOutFile(doc);

     

                              }

 

 

 

i do not know what method in the CS SDK to open document fom active window and  how to map CMIS Document to com.adobe.indesign Document ?

 
Replies
  • Currently Being Moderated
    Aug 29, 2012 6:23 AM   in reply to ferry 77

    Adobe Drive is not scriptable so it is not an option here. But you can use the CMIS library swc to achieve what you want to do. A sample project - CMISWorkflow - for ExtensionBuilder 2 is attached.

     

    You want to stucture your code so that the classes that deal with InDesign and those that deal with the CMIS library are distinct so that the collision on the Document type name (InDesign versus CMIS) is less confusing. In the sample code the InDesignController deals with InDesign documents and the CMISController deals with CMIS documents.

     

    To integrate the distinct layers you can use a local file cache class such as FileCache in the sample code. Documents are downloaded from the CMIS repository and cached in files in a well known location on your local filesystem - under the ~/CMISWorkflow/cache folder in the case of the sample.

     

    You can map from a CMIS document to an InDesign document as follows:

     

    1) Download the CMIS document's content stream into a flash.filesystem.File on your local drive. The approach taken by the sample code is to reflect the structure of the remote repository in the structure of the local cache - so a file with a path /foo/bar.indd on the server gets downloaded into ~/CMISWorkflow/cache/foo/bar.indd. Then it is easy to map from local path to the associated path on the CMIS server.

     

    2) Use InDesign.app.open() to open the file as an InDesign Document.

     

    Entries in the sample FileCache are keyed by the local file. You can store the CMIS document object associated with a file being edited in the FileCache so that you can check it back in later.

     

    Hope this info helps you get started.

     

    Best regards,

    Seoras

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 5:59 AM   in reply to ferry 77

    You must use CMIS paths when calling GetObjectByPath - they use / as a separator so you want to use "/Collaboration/test2.indd.pdf". Yup this is a bug in the sample code which was put together for you on a Mac.

     

    Seoras

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 9:52 AM   in reply to ferry 77

    Step through the upload code in the debugger.

     

    Are you somehow calling CreateDocumentRequest repeatedly with a path that already exists in the server? That seems the most likely cause of what you are observing. There is a call to GetObjectByPathRequest that should fail if the document does not already exist and needs to be created. Is that logic working?

     

    Or are you saying that calling SetContentStreamRequest on an existing document causes a new document with the same name to be created in your server?

     

    Seoras

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 12:10 PM   in reply to ferry 77

    If you want versioning of the pdf and other generated artefacts why don't you try a check out / check in workflow with them.

     

    Best regards,

    Seoras

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

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