title: Attach Pdf to email composer in ionic
body: <p>i am trying to attach the blob pdf file to email composer . But it is not working for me.</p>
  
  <pre><code>function createPdf(reportData){
           return $q(function(resolve, reject) {
              var dd = createDocumentDefinition(reportData);
              var pdf = pdfMake.createPdf(dd)
              .getBuffer(function(buffer){
                  var utf8 = new Uint8Array(buffer); // Convert to UTF-8... 
                  binaryArray = utf8.buffer; // Convert to Binary...
                  $cordovaFile.writeFile(cordova.file.dataDirectory, "file.pdf", binaryArray, true)
                  .then(function (success) {
                     alert('Pdf created'); 
                  console.log("pdf created");
                  }, function (error) {
                  console.log("error");
                  });
              });
          });
      }
  </code></pre>
  
  <p>This code works and it alert pdf created.</p>
  
  <pre><code>pdfGenerator.createPdf(reportbody)
        .then(function(pdf){
          $ionicLoading.hide();
          var blob = new Blob([pdf], {type: 'application/pdf'});
          $scope.pdfUrl = URL.createObjectURL(blob);
              var email = {
             to: 'max@mustermann.de',
             cc: 'erika@mustermann.de',
             bcc: ['john@doe.com', 'jane@doe.com'],
             attachments: [$scope.pdfUrl],
             subject: 'Cordova Icons',
             body: 'How are you? Nice greetings from Leipzig',
             isHtml: true
           };
  
          $cordovaEmailComposer.open(email).then(null, function () {
            // user cancelled email
          });
        },function(error){
          console.log(error);
        });
  </code></pre>
  
  <p>When i console the cordova.file.dataDirectory it gives me cdvfile:// path not the native path. So how can i attach the file to mail.</p>