I am using an API which provides me base64 encoded content. It is mentioned that we can download the PDF file by saving the content to a .pdf file.
In the API documentation, it's clearly mentioned
A PDF that contains the contents of the invoice. You encode the content with a Base64 string to create a Base64-encoded .pdf file.
You can query this field to download the invoice PDF for a specific invoice. After you query it, you can save the string to a .pdf file, then view the file in any PDF reader.
I am using TCPDF to write the content in PDF file. But it generates a blank PDF file.
$PDF = new PDF('Test Title', 'Test Subject');
$PDF->GetTCPDF()->write(0, 0, '', '', base64_decode($this->Get(self::Body)), 0, 1, 0, true, '', true);
$PDF->Download();
Am I doing anything wrong?
I think you should use this code to get your pdf file :
Then you can open it.
Or you can echo the content to your page like this :
Good luck