5

Candidates use my PHP application to upload their CV in either Word or PDF format. I want to convert the Word documents (doc or docx) to PDF. I have tried using on-server solutions (PHP libraries), but can not find one that is reliable enough so I am now exploring Google solutions.

It seems that the Drive API has just what I need. I can:

  • upload a Word document and request conversion to Google Doc.
  • export the doc as a PDF
  • delete the doc

The problem is that (as far as I can see), the only way I can access the Drive API is via OAuth 2, which is quite an overhead in the case of simple server-to-server access. I would prefer to use a simple API key.

As far as I can see, if I want to use an API key, then I need to sign up for a Google Service Account, which again seems like quite an overhead. (I only want to convert some files, right?).

Is there a straightforward way to achieve my goal (using Google resources)? Or are the two options above my only choices?

DatsunBing
  • 8,684
  • 17
  • 87
  • 172
  • You want to achieve to convert from word formato to PDF without OAuth2 and Service Account. If my understanding is correct, how about using [Web Apps](https://developers.google.com/apps-script/guides/web) with Google Apps Script? In this case, you can achieve it without OAuth2 and Service Account. If this was not useful for your situation, I apologize. – Tanaike Mar 20 '19 at 23:02

1 Answers1

2

Your use case is a perfect fit for a Service Account. It's not really much of an overhead, say 10 minutes to set up the account and a couple of hours to write the auth code. If you would rather use a regular account, check out How do I authorise an app (web or installed) without user intervention? which has step by step instructions and sample code.

pinoyyid
  • 21,499
  • 14
  • 64
  • 115