Generating a PDF using Google Docs API - html

Is it possible to provide HTML for the Google Docs API and have it output as a PDF? As far as I can tell, it seems like it is possible to submit an HTML document to Google Docs, and then have Google Docs convert it to a PDF.
I'm checking the API documentation and it has a lot of information about dealing with PDFs already created, but I'm not seeing anything about creating them.
Also, does it accept CSS styling as well, or is it pure HTML?

Yes, it is, with two requests. You can import the file as a Google Docs, then export it to PDF. Using the Drive API.
https://developers.google.com/drive/v2/reference/files/insert https://developers.google.com/drive/v2/reference/files/get
this is what your saying right?

Related

How can I use the Google Docs API to get the HTML from a Google Doc?

I am using the Google Docs API from googleapis#39 and I want to get the HTML. What I currently have is a way to get this object from the API without a problem. I can't find a way to turn that object into HTML. Can someone please assist me? I have already tried a few different approaches to this problem such as trying to get the HTML from the Google API directly and converting the object into HTML.
Thank you!
I could understand that you wanted to convert Google Document to HTML data.
In this case, your goal can be achieved with the method of "Files: export" of Drive API. Ref I think that this is the answer for your question.

Google drive api Export-complete syntax

Google drive api provides the following code to export files. GET https://www.googleapis.com/drive/v3/files/fileId/export. However, it doesn't work by itself, it needs the mimeType. Where do I put the MimeType. I need the complete syntax. Thank you.
https://www.googleapis.com/drive/v3/files/$fileId/export?mimeType=application/vnd.openxmlformats-officedocument.wordprocessingml.document

Generate a google doc via Java

I've been swimming through searches and tutorials and guides and references for days, and I can't seem to find a good way to generate google docs via Java.
I can generate/import .txt files as regular google doc files successfully with java using the drive api, but that's only text files; I need to at least include unordered lists and links in the doc for it to be useful.
My next attempt would be to generate a .rtf or a .doc and then try to import that into google docs, but before I embark on such a project, I wanted to ask you guys first. I also see the realtime api, but it looks like it doesn't specifically deal with docs, just arbitrary data.
What's the recommended way to upload a new google doc with lists and links and stuff?
Thanks!
Probably the simplest import format would be HTML. Just set convert=true and you should be good to go.
There is no stand-alone API for creating or manipulating the contents of Google Docs files. As you've found, you can create documents in other formats and import them with the Drive API.
If you don't need to work in Java, the other option is to use Google Apps Script, which provides a service for creating and manipulating Google Docs files. More information in this guide.

Google drive and confidential files

I have been looking for quite some time and cannot seem to find the answer I need. I tried using the iframe tag method for Google Docs Viewer to view my files and noticed that pptx, xlsx, etc... PDF seems to be the only one that is visible. So I came to the conclusion I have to use Google Drive and it's API. If that is so, my question is... Can I keep these files hosted on my clients server and use the API to view the files or do they have to be hosted on Google Drive's cloud server? Thank you.
No, this is not possible, sorry. All files are stored on the Google Drive cloud servers.

'GOverlay is undefined' javascript error in IE 7, in spite of having loaded the Google Maps API

Despite loading the Google Maps API, via this url:
http://maps.gstatic.com/intl/en_ALL/mapfiles/276b/maps2.api/main.js
I'm getting the above error.
Why is it that when I download that URL in my browser and do a find for 'GOverlay' I'm getting zero matches?
Have Google removed this from their API or something, causing all my code to break?
GOverlay is an essential part of the Google Maps API implementation, see the V2 documentation for GOverlay here.
The reason for you not finding "GOverlay" when searching through the Javascript file you provided is simply that the Google Maps API consists of several Javascript files, not all of the code is in main.js. Additionally the code is obfuscated which could mean the build GOverlay by concatenating some crazy strings.
On a basic note: Why do you want to use some static JS file? The offical way to use the Google Maps API is using a key, which you have to obtain by registering with your Google account. So actually the URL you should be using is:
http://maps.google.com/maps?file=api&v=2&key=abcdefg
Or use the AJAX loader as seen on the Google Maps V2 documentation here.
The code is actually loaded asynchronously.
Post a link to your page - it is more than likely that there's some issue with your code.