I have the same problem, but found out that PDF's I created with a software on my laptop worked just fine.
PDF invoices created with TCPDF or PFPDF (PHP PDF generator), will not work since they are not accepted as PDF's with correct headers (I guess), and the error:
Economic.Api.Exceptions.ValidationException(E04000): File is not valid PDF. {id=XXX} is returned.
Note this issue is when attaching a PDF to a voucherNumber with following code:- Code: Select all
// testet with:
$pdf = $path;
$encoded = file_get_contents($pdf);
// and
//$encoded = base64_encode($pdf);
$client->CashBook_RegisterPdfVoucher(array("data"=>$encoded, "voucherNumber"=>$voucherNumber, "entryDate"=>$voucherDate));
Is it something the E-conomic team can check up on? I have tested and found the bug with Joomla! 2.5 and Virtuemart 2.0.X. The bug is not in the Joomla! og Virtuemart itself, but e-conomic.
If I download the generated PDF and save it as a copy on my laptop, and then upload it via API, the error is still shown. I imagine e-conomic doesn't approve generated PDF's via API (or maybe "old-version-PDF's") at the moment?
It is odd, since the generated PDF is accepted with no problem when e-mailing it as attachement to the e-conomicmail given for import. :S
Best regards Lasse