0

I have created a simple application with google apps script to generate pdf invoices from a spreadsheet. The documents are generated by "export url".

See my code here

The application is going to be used mainly through google docs apps for iOs and Android. Being pretty basic it does everything we need, except ... it is not possible to make it open the pdf document after finishing the creation to give option to download it, print it, send it, or whatever. I can not find a way to display the document without the user having to go and look for the file in the destination folder and double click on it. I would like to save the user those additional clicks.

The most I have achieved is to open a modal dialog using htmloutput, generating the link so that the user clicks the link and opens the file, but this only works in the desktop version when you access through the browser.

function openDialog(urlFile,nameFile) {
 var strHtml = "<p>New PDF</p>" + "<p> Download Here: " 
   + '<a target="blank" href="' + urlFile + '">' + nameFile 
   + '</a></p>';
 var HTMLOutput = HtmlService.createHtmlOutput(strHtml);
 SpreadsheetApp.getUi().showModalDialog(HTMLOutput, 'INVOICE');
}

Taken from here

Well, I understand that the reason why google apps does not open documents or links directly is mainly for security reasons, but we are talking about the same file that I just created, that I am its owner and I already have access to the id and url. There should be a way to do a preview. I have not found many solutions to this, and all go through making use of Web Apps, but even these need the user to click to open the file. Am I missing something? Please, new ideas are welcome.

Thanks, regards

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Francisco Javier
  • 107
  • 1
  • 1
  • 9

1 Answers1

0

Someone has suggested that what I want could be done through an Intent. Maybe I'll take a look, but anyway start programming for Android, which I have no knowledge of (as for iOS) is beyond my pretensions with this simple script for google spreadsheets. However, thank you very much.

Francisco Javier
  • 107
  • 1
  • 1
  • 9