How to generate preview of documents saved in google drive? - google-drive-api

I am trying trying to create a preview of a document saved in google drive using google viewer with -
https://docs.google.com/viewer?authuser=0&srcid={some document id}&pid=explorer&a=v&chrome=false&embedded=true
Unfortunately it only works for pdf files. The other important point is that I want to do it without making the uploaded document public.

For get PDF file preview you can use below link :
https://lh3.google.com/u/0/d/]{FILEID}=w200-h150-p-k-nu-iv1
for example : https://lh3.google.com/u/0/d/0BwVBMmQvtcsJUkNSVFllbjRLMzZab0haTEtLajE1M2haekZj=w200-h150-p-k-nu-iv1

Drive/docs only supports importing of Word documents, as I understand, it doesn't support previewing on them in their native form. So you would have to use the Google Documents List API to import and convert them to the native Google Document text format. The problem with this is that you don't get a round-trip (you can't reopen that document in Word). The only real option here is to export as pdf from word and save that. And if you want the general public to be able to preview it, making it public is the only solution. I don't think the technologies you're using match the problem you're trying to solve...

Try using this URL for PDF: http://docs.google.com/viewer?url=https%3A%2F%2Fdocs.google.com%2Fuc%3Fexport%3Ddownload%26id%3D{fileID}&embedded=true
and this URL for other files: https://docs.google.com/viewer?url=https%3A%2F%2Fdocs.google.com%2Fdocument%2Fd%2F{fileID}%2Fexport%3Fformat=pdf&embedded=true
Keep in mind that files should be public.

Related

Dynamic PDF Generation from Salesforce Data

I'm looking for some recommendations on a solution to build dynamic PDFs using salesforce object data. We currently have a layout designed in photoshop, that we're looking to import into Salesforce and fill in various snippets/images based on data that lies within an object. The final product should come out as a PDF
I started building this using Adobe XFDF. I exported the PSD as a PDF and created a fillable form from it. This was then populated from an XFDF file generated from Salesforce. This does work but the design issues with fillable forms, requirement for acrobat pro on every system that uses it and the lack of support for referencing file templates that are not local have killed this. One of these issues alone wouldn't be deal breakers, but all 3 combined are too much to overcome.
While this is mostly all sorted out on the Salesforce side, I'm not sure of the best way to proceed with this when it comes to PDF generation, here are a couple of ideas that might work, but I don't have enough experience to be sure:
Generate HTML/CSS File from PSD file, upload to salesforce, modify html file within salesforce, send to PDF generation API - adobe api looks promising for this, but can I send over html and css files together to generate a single PDF?
Use Salesforce PDF tools to generate PDF, will need to modify visualforce page to the same design as reference design in PSD.
Use some sort of third party PDF generator tool that will allow me to reference my current design as a template.
I'm open to any suggestions, Thanks!
In salesforce, PDF can be generated without using any app. Check out the official document by Salesforce.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_output_pdf_renderas.htm
A quick start guide How to generate PDF in Salesforce
It does not require any purchase or separate license. If you are looking specifically an App, it can be found on app exchange.
https://appexchange.salesforce.com/appxSearchKeywordResults?keywords=pdf%20generator

Print Multiple HTML files automatically using a printer/Network Printer

I looking for a solution to print multiple HTML files/URLs to print automatically from the printer with Just one click from my custom android app.
So earlier I use to print these multiple files using Google Cloud API. So using that API we use to add those files to the Google cloud and then Google Cloud automatically prints those HTML files from the printer which is configured. Since Google cloud is no more available to use so I am looking for an automatic solution.
Is there any solution for printing multiple HTML files using EPSON printer tm-t20 by using some API OR some android code which I can integrate to print these HTML automatically?
This is a very broad question. I suggest asking a series of more focussed questions to get specific answers to the various problems you are faced with. Anyway here are some ideas for you...
There are a few things going on here. You need to process a URL, convert that URL into something printable (probably a PDF file) and then automate the printing of it on your Epson printer.
Software is available to automatically print documents that appear in a folder on your network, so you can use that kind of thing to print PDFs. Google "automatically print pdf files in folder" and find something that will work with your printer.
For the other problem of getting something printable from a URL, I presume you do not wish to code up your own solution, so perhaps you can find an App to render HTML to PDF and save the file to a folder or network location. Have a look at IFTT, there is an app there called Pocket, that can convert a URL to PDF and save it to Google Drive. If you link Google Drive to the folder on your network that automatically prints documents, perhaps you will have a solution!
You can use ezeep print api it is a replacement for gooogle ckoud print,
I'm the developer community manager I help people with the api integrations and the pai is pretty easy to use . check it out at ezeep.com
let me know if oyu need help

Auto-Convert OneNote to PDF

I am trying to automatically convert some Microsoft OneNote files to PDF to send as a daily email attachment. I have thought of two systematic solutions but need some help in finding the right tools:
Find an application that may be programmatically called (via a Python script e.g.) that will convert a Microsoft OneNote file to a PDF.
Find a way for OneNote to automatically save files as PDFs every time it auto-saves.
Is anyone aware of tools available for either solution?
See my answer to your other question
The approach would be to get the pages content with
./me/onenote/pages/1-1c13bcbae2fdd747a95b3e5386caddf1!1-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/content?includeIDs=true&includeInkML=true&preAuthenticated=true
and then render the html on a canvas with javascript/jquery.
render ink with InkMLjs
and then use a library to convert the canvas to a pdf for example with canvas2pdf
Another approach might be something like Automator for osx. You could get the pages of interest with the microsoft-graph api, open them in a web browser using applescript and when the page has finished rendering -> print -> "Save as PDF"

Upload or create new file with content via Google Drive REST API?

I'm trying to create a new document based on a template through the Google Drive REST API (I'm not using the Java or JS SDKs).
I'd like to create the document based on a word-processing template, either by downloading the template from Drive and replacing some content $keywords, or, editing an rtf format template and inserting that as a new file.
I'm comfortable with REST and I'm able to download the template from Drive, and access the exportLinks to download the file content as rtf or txt. But... once I've edited the content, how to I provide that content as fileContent to the insert/update http post?
Is this possible? I thought it would be through the method:
POST https://www.googleapis.com/upload/drive/v2/files
Thanks!
Yes, it is possible. Take a look at this documentation: https://developers.google.com/drive/manage-uploads You can use simple media upload or multipart upload each of which are well documented in the link above.
FYI, if you already have a file and you just want to replace the data of it, you would also want to take a look at Files.update. The way you upload is same as the documentation above.

Will the .zip format be supported for Google Documents via drive?

Right now my application downloads the documents as zip-archive via GData API.
I'd like to switch to the new "exportLinks" feature of drive, but I don't see the zip format
in the list of supported formats.
Or is there a different way to export documents as HTML including images?
For now there is no plans to support ZIP export but I just filed a feature so that this can be reviewed by the team and prioritized.
For now you could use the HTML export link, it will get you the Google Document in HTML where all the images are external links hosted on Google servers (some https://lhX.googleusercontent.com/<longID> URLs) And then you would have to write a script that would get all these links from the HTML and then fetch them.