Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
Helper methods for PDF attachments. Methods to get the existing attac…
Browse files Browse the repository at this point in the history
…hment and to upload a new attachment.
  • Loading branch information
kalaspuff committed Feb 6, 2014
1 parent 536739a commit 8d6fcd3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Billogram/Api/Objects/BillogramObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,31 @@ public function getInvoicePdf($letterId = null, $invoiceNo = null)

return base64_decode($response->data->content);
}

/**
* Returns the PDF-file content for the billogram's attachment.
*
**/
public function getAttachmentPdf()
{
$response = $this->api->get(
$this->url() . '/attachment.pdf',
null,
'application/json'
);

return base64_decode($response->data->content);
}

/**
* Attach a PDF to the billogram.
*
**/
public function attachPdf($filepath)
{
$content = file_get_contents($filepath);
$filename = basename($filepath);

return $this->performEvent('attach', array('filename' => $filename, 'content' => base64_encode('asdf')));
}
}

0 comments on commit 8d6fcd3

Please sign in to comment.