Pages

Showing posts with label document. Show all posts
Showing posts with label document. Show all posts

Wednesday, March 11, 2015

Using Google Document List APIs to build Memeo Connect for Google Docs


Building Memeo Connect for Google Docs

Editors Note: This post was written by our partner Memeo, a digital media management company. Memeo Connect™ for Google Docs enhances Google Docs capabilities. We invited Memeo to share their experiences building an application on top of Google Apps utilizing some of our APIs. Other partners will share their experiences in future posts. 

Hi Im Matthew Tonkin, Mac Applications Architect at Memeo.  Google has been a great partner in helping us bring Memeo Connect to market.  Were excited about the new additions to the Google Documents List APIs and the products weve been working on for them.

Google Apps  is a great way for businesses to share and collaborate on documents, but more importantly, it has allowed businesses to move much of their office and IT infrastructure online for dramatic operating cost reductions.  Until recently, Google Docs users had no way of uploading, storing, syncing and sharing files of any type.  The big news is that Google Docs now supports all file types and there are Documents List APIs to prove it.  January saw the release of the updated Documents List API with this new arbitrary file support, but no desktop client software to manage file syncing between the desktop and the cloud.  Memeo Connect for Google Apps is that missing link.  Memeo set out to bridge Google Docs cloud storage with desktop software.  A simple goal that has big implications for where users store documents and how they are shared.  

The end result is a desktop application that is fully supported by Google Docs for online storage, synchronization, sharing and data management. With Memeo Connect, instant access to your important documents while online or offline is now very possible. Memeo Connect is available on both Windows and Mac platforms.







Our timeline for Memeo Connect was impossibly short due to Google’s aggressive timeline for launch. How did we do it?  Apart from the obvious late nights, junk food and beer, we received help from Google to take this product from concept to reality.  Some of it came in the form of new APIs, some directly from the Documents List API team, some from the client libraries and some from the discussion groups.



1. Keeping native file formats

Google Docs now supports keeping files in their native format.  Previously Microsoft Office files and images were converted to the online Google Document formats, removing much of the application specific formatting options used in the Office file formats.  However, its now possible to upload Microsoft Office files and images without conversion, meaning users can keep all of their custom file formatting.

You can get all of this with a simple parameter in the post URL when uploading the new document.

Google Documents List API

https://docs.google.com/feeds/default/private/full?convert=false










If like us, you use the client libraries, then its just as easy.

Google Data Objective-C client library**

NSURL *uploadURL = [[mDocListFeed postLink] URL];
GDataQueryDocs *uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];
[uploadQuery setShouldConvertUpload:NO];


Google Data .NET client library

string uploadURL = DocumentsListQuery.documentsBaseUri + "?convert=false";
docService.StreamSend(new Uri(uploadURL), fileStreamHandle, GDataRequestType.Insert, contentType, docTitle); 


The new features dont just handle Microsoft Office files.  Any file type is supported with no additional parameters or changes to client code, however the support for these features is only available through the Google Documents List API for users that have a Premier account.



2. Bigger file size limits and resumable uploads

Google Docs now supports file uploads up to 1GB and is resumable, so failed or paused uploads can pick up where they left off.

Google Documents List API
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#ResumableUpload


Resumable post link:

resumable-create-media" type="application/atom+xml"
    href="https://docs.google.com/feeds/upload/create-session/default/private/full"/>


Request:

POST /feeds/upload/create-session/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization:
Content-Length: 0
Content-Type: application/pdf
Slug: MyTitle
X-Upload-Content-Type: application/pdf
X-Upload-Content-Length: 1234567



Resuming:

POST HTTP/1.1
Host: docs.google.com
Content-Length: 100000
Content-Type: application/pdf
Content-Range: bytes 0-99999/1234567



Google Data Objective-C client library**

Resumable uploads are automatically enabled when switching to the uploadLink URL

NSURL *uploadURL = [[mDocListFeed uploadLink] URL];
GDataQueryDocs * uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];

Pausing and resuming uploads is also made easy.

[mUploadTicket pauseUpload];
[mUploadTicket resumeUpload];

Google Data .NET client library

ResumableUploader resumableUploader = new ResumableUploader();
if (newFile)
    resumableUploader.Insert(authentication, docEntry);
else if (partialFile)
    resumableUploader.Resume(authentication, resumeUri, httpMethod, fileStream, cotentType);
else if (updateExistingFile)
    resumableUploader.Update(authentication, docEntry);

** Objective-C code samples have been taken from the Docs Sample code



3. Client Libraries for Mac & Windows

The Google Documents List API provides all of the backend server functionality but isnt ideal for rapid client application development.  As client developers, we prefer the efficiencies provided by a wrapper in our native client languages.  This is where the client libraries for Objective-C and .NET allowed us to shorten our application development time significantly.  Without the client libraries, we simply would not have been able to achieve our goals for Memeo Connect in the time we had available.

Many of the Documents List API features we worked with in our early development were not available through the client libraries.  This was initially quite daunting because of the risk that we would have to drop down to raw server calls and miss out on the efficiencies we gained through using the client libraries.  However as we got to know the client libraries better, we found they were written flexibly enough that we never had to do that - there was always a way to bend them enough to get what we needed.  A sign of great design by their architects.

For example uploading without conversion was simple in the Objective-C client library even before it was officially updated to support it.

NSURL *uploadURL = [[mDocListFeed postLink] URL];
GDataQueryDocs *uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];
[uploadQuery addCustomParameterWithName:@"convert" value:@"false"];



4. Support from Google

The Documents List API team were of enormous help throughout the course of this project.  As with most of Googles public APIs, theres always an avenue to ask questions about how to best use the technology, pursue bugs or request new features.  The new Google Apps Discussion Groups are simply the best way to get an answer quickly and is invaluable in getting past whatever is blocking your progress. Google Developer Relations people monitor the discussion groups and frequently answer questions, link to other relevant resources, and provide code samples.


Whats next?

We had a sizable list of things we really wanted to do with Memeo Connect 1.0 and some of that had to wait for 1.x or 2.0.  Were looking forward to continuing to work with Google and file as many feature requests as we can to make some of these new features a reality.  Anyone can file a feature request for Google Apps APIs and I can assure you they all get considered.

In future releases well be adding more support for direct file system integration, better tools to manage sharing and were really excited about supporting new devices.  Get ready to see more Google Docs in more places.
Read more »

Monday, March 9, 2015

Gmail and Document Services now available in Apps Script

If you’ve used Google Apps Script before, you’ll know that we have deep integration with many Google Apps & APIs. You can access your Calendar and Contacts, create Google Sites, send email, and lots more. But two integrations were noticeably missing: the Google Docs word processor, and Gmail. A few weeks ago, at Google IO, we announced new Apps Script APIs for these two great products.

GmailApp - read, label and send emails

The new GmailApp should be instantly familiar if you’re used to using Gmail. You have access to labels, threads, and messages, and you can do all the things you expect: change labels, add and remove stars, mark things as important or trash or spam. You can also use the GmailApp.search() method to do any search you can do in Gmail itself. This is the first full fidelity API to Gmail, and we’re excited to see what you all will do with it.

To make sure your Gmail account remains private and secure, we are extra cautious about any script that uses GmailApp. Any time you change the code for a script that accesses Gmail, we will require you to reauthorize the script to run. Keep that in mind when editing a script that runs on a trigger - if you don’t reauthorize it, it will fail the next time the trigger tries to run it.

DocumentApp - create and edit Docs

The new DocumentApp lets you create new documents or open existing ones by id. The id of a document is always in the URL you see when visiting it, and document ids are consistent between DocumentApp and the existing DocsList service, so you can use DocsList.find() to search for a document, and then get its id from File.getId().

Once you have a document, you can access all of its individual elements. You can do search and replace (great for mail merge!), change styles or text, add or remove tables and lists, and much more. And when you are done, you can call Document.saveAndClose(), which makes sure all of your changes to the document get saved. If you don’t call it, we’ll do it for you at the end of the script, but it can be useful to call it yourself if you’d like to do something with the document after making your edits.

GmailApp and DocumentApp are available to all Apps Script users right now. Now the only question is, what are you going to build with them?

Want to weigh in on this topic? Discuss on Buzz

Read more »

Thursday, February 5, 2015

Photoshop Copying a Layer onto a New Document



You can use the Move tool to copy a layer onto a new document.

Choose the Move tool from the Tools panel. Select the layer you want to copy then click and drag it to the new document where you want to copy it to.

To copy multiple layers, make multiple layer selections in the layers palette.
  • To make multiple layer selections in the Layers palette, hold down either the shift key or the control key and click on the layers that you would like to select (if youre on a Mac, you can use either the shift key or the command key).
Then from the layers palette, drag the layers onto the new document.
Read more »