PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 6, 2022

[FIXED] PHP DocuSign: getting empty document when downloading the completed signed document

 February 06, 2022     docusignapi, jwt, laravel, pdf, php     No comments   

Issue

I integrated Docusing with a PHP Laravel App using JWT Auth. It's working perfectly, could send the email to recipients for signing. Now after all signing is done we would like to download the complete signed document with CoC.

I'm using following code to get the signed document for a specific Envelope:

$envelope_api = new EnvelopesApi($apiClient);

$tmpFile = $envelope_api->getDocument($account_id, 'combined', $envelope_id);

$savCert = file_put_contents("signed_document.pdf", file_get_contents($tmpFile->getPathname()));

But I'm getting the empty document when the file is downloaded. It would very helpful if you could give a hint how to resolve the issue.

json payload for a $tmpfile:

object(SplFileObject)#418 (5) 
{
 ["pathName":"SplFileInfo":private]=> string(44) "C:\Users\AppData\Local\Temp\19F.tmp" 
 ["fileName":"SplFileInfo":private]=> string(7) "19F.tmp" 
 ["openMode":"SplFileObject":private]=> string(1) "r" 
 ["delimiter":"SplFileObject":private]=> string(1) "," 
 ["enclosure":"SplFileObject":private]=> string(1) """ 
}

Solution

This is a bug in version 6.5 of the SDK Version 6.5.1 has the fix. Please update your package and try again.

If you use 6.5 you will need to add these lines:

$tmpFile = $envelopeApi->getDocument($account_id, 'combined', $envelope_id);
$tmpFile->rewind();
$contents = $tmpFile->fread($tmpFile->fstat()['size']);


Answered By - Inbar Gazit
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing