composer require zendframework/zendpdf
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use ZendPdf\PdfDocument;
use ZendPdf\Font;
use ZendPdf\Page;
class PDFController extends Controller
{
public function getDocument() {
$filename = "sample.pdf";
// $pdf = PdfDocument::load("path/to/file.pdf");
$pdf = new PdfDocument();
// $font = Font::fontWithPath('Courier.ttf');
$font = Font::fontWithName('Courier');
$pdfPage = new Page(Page::SIZE_A4);
$pdfPage->setFont($font, 24);
$pdfPage->drawText('ZendPDF Laravel 5', 100, 800, 'UTF-8');
$pdf->pages[] = $pdfPage;
$pdf->save($filename);
return \Response::make($pdf->render(), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="' . $filename . '"'
]);
}
}
displayValue = function() {
texts.append("text")
.text(function(){
return dataset[0].value;
})
.attr('id', "Value")
// .attr('transform', "translate(" + trX + ", " + trY+ ")")
.attr('transform', "translate(" + (width + margin.left) + ", " + ((height + margin.top) / 1.5) + ")")
.attr("font-size",18)
.style("fill", '#000000');
}