title: Create PDF File with DriveApp.createFile with results of UrlFetchApp.fetch
body: <p>I cannot create a PDF file in my Google Drive from content retrieved using UrlFetchApp.fetch</p>
  
  <p>If I email the same file attached It arrives properly.
  Here is my code:</p>
  
  <pre><code>var codigo ="1100016795766";
  var url = "http://do.convertapi.com/Web2Pdf";
  var headers = {"Content-Type":"multipart/form-data"
          };
  
  var payload=  {"ApiKey":"xxxxxxxx",
               "CUrl":"http://www.correos.cl/SitePages/seguimiento/seguimiento.aspx?envio="+codigo,
               "LowQuality":true
              }
  var options = { "method":"POST",
    "headers": headers,
    "payload":payload,
    "muteHttpExceptions":false
    };
  var       pdf0=UrlFetchApp.fetch(url,options);
  
  //trying several ways
  var        pdf=pdf0.getContent();
  var       pdf1=pdf0.getAs('application/pdf');
  var       pdf2=pdf0.getAs("application/pdf");
  var       pdf3=pdf0.getContentText();
  
  
  //Trying several ways, none of them get a valid PDF file
  
  DriveApp.createFile("8track_correos.pdf", pdf, 'application/pdf');
  DriveApp.createFile("9track_correos.pdf", pdf0,'application/pdf');
  DriveApp.createFile("1track_correos.pdf", pdf1, MimeType.PDF);
  DriveApp.createFile("2track_correos.pdf", pdf1, MimeType.PDF);
  DriveApp.createFile("4track_correos.pdf", pdf3);
  DriveApp.createFile("7track_correos.pdf", pdf2);
  DriveApp.createFile("6track_correos.pdf", pdf1);
  
  
  //The attached file arrives as a good PDF file
  
  MailApp.sendEmail("user@gmail.com", "prueba de enviar PDF", "k", {attachments:[{fileName:prefijo+p_nombre+p_apellido+"track_correos.pdf", content:pdf, mimeType:"application//pdf"}]}); 
  </code></pre>