A PhoneGap plugin for the Creative SDK Send To Desktop API.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
docs
spec
src
www
.editorconfig
.gitignore
.jshintrc
.npmignore
.plugin.xml.swp
CHANGELOG.md
LICENSE
README.md
package.json
plugin.xml

README.md

phonegap-plugin-csdk-send-to-desktop

Stories in Ready

The Creative SDK provides a simple way for your mobile users to send their work from your app directly to Adobe desktop apps.

You can specify which application the shared data will open in. Three applications support this feature: Photoshop, Illustrator, and InDesign.

This plugin makes it possible for you to use the Creative SDK Send To Desktop API in your PhoneGap apps. Read on to learn how!

Contents

Prerequisites

Required: You must first install the following plugins for this plugin to work:

Required: This guide will assume that you have installed all software and completed all of the steps in the plugin guides linked above.

Required: Your user must be logged in to with their Adobe ID (via the User Auth plugin) for Send To Desktop to work.

Installation

Adding the plugin

Use the command below to add the plugin to your app.

phonegap plugin add --save phonegap-plugin-csdk-send-to-desktop

Downloading the Creative SDK

iOS

No action is required for iOS. The portions of the Creative SDK required for this plugin are already included in the UserAuth plugin.

Android

No action is required for Android. The Creative SDK for Android is delivered as a remote Maven repository, and the required framework will be downloaded automatically by the plugin.

Setup guide

  1. cd into your existing PhoneGap app (must already include Client Auth and User Auth)
  2. Add this plugin (see "Adding the plugin" above)
  3. Build and run for your platform

Sample code

www/index.html

Add a button within the body. The PhoneGap "Hello World" example includes a div with an ID of app, so for this example, we are including it in there.

// ...

<div class="app">

    // ...

    <button id="send-to-desktop">Send to Photoshop</button>
</div>

// ...

www/js/index.js

Note: Most of the code below comes from the PhoneGap "Hello World" example, and we are providing it here for context.

This plugin provides access to a global CSDKSendToDesktop object.

The CSDKSendToDesktop object exposes a .send() function.

See comments #1-2 below for relevant code.

Note: This code assumes you have completed the steps in the User Auth plugin README and you have already logged your user in with their Adobe ID.

var app = {
    initialize: function() {
        this.bindEvents();
    },
    bindEvents: function() {
        // ...

        /* 1) Add a click handler for your button */
        document.getElementById('send-to-desktop').addEventListener('click', this.sendToDesktop, false);
    },
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    receivedEvent: function(id) {
        // ...
    },
    login: function() {
        // See the User Auth plugin repo sample code
    },
    logout: function() {
        // See the User Auth plugin repo sample code
    },
    /* 2) Make a helper function to send to Adobe desktop apps */
    sendToDesktop: function() {

        /* 2.a) Prep work for calling `.send()` */
        function success() {
            console.log("Sent to Photoshop!");
        }

        function error(error) {
            console.log("Error!", error);
        }

        var imageUri = "<YOUR_IMAGE_HERE>";

        var ccApplication = CSDKSendToDesktop.AppType.PHOTOSHOP;

        var mimeType = "image/jpeg";


        /*
            2.b) Send to desktop
            NOTE: your user must be logged in (`this.login`) via the
            User Auth plugin BEFORE calling this.

            See the User Auth plugin repo's sample code for more info.
        */
        CSDKSendToDesktop.send(success, error, imageUri, ccApplication, mimeType);
    }
};

API guide

See the full API guide.