我正在与recurly一起为客户开帐单。但是,如何获取发票pdf?
到目前为止,我有一张带有发票的表格。我显示发票的状态,计划,开始日期,结束日期。然后我还有一个像这样的链接:
/ user / invoicepdf / invoicenr / 1502
链接转到我的invoicepdfaction,并发送invoicenr参数。
在我的发票pdfaction中,我有以下内容:
public function invoicepdfAction() {
header('Content-Type:', 'application/pdf');
header('Content-Disposition:', 'inline;');
$request = $this->getRequest();
$invoice_number = $request->getParam('invoicenr');
try {
$pdf = Recurly_Invoice::getInvoicePdf($invoice_number, 'en-US');
var_dump($pdf);
} catch (Recurly_NotFoundError $e) {
print "Invoice not found.\n";
}
}
我的var_dump显示了这一点。
但是,如何在浏览器中显示pdf?(或直接下载)
这通常对我有用:
$request = $this->getRequest();
$invoice_number = $request->getParam('invoicenr');
try {
header('Content-type: application/pdf');
header('Accept-Language: en-US');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
$pdf = Recurly_Invoice::getInvoicePdf($invoice_number, 'en-US');
print($pdf);
} catch (Recurly_NotFoundError $e) {
print "Invoice not found.\n";
}
您可以随时向[email protected]提交支持凭单,因为他们为所有客户端库提供支持。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句