Skip to content

Instantly share code, notes, and snippets.

@mkdesignn
Created July 8, 2017 18:56
Show Gist options
  • Save mkdesignn/dff5b11b699b671b43cb68eb86be8558 to your computer and use it in GitHub Desktop.
Save mkdesignn/dff5b11b699b671b43cb68eb86be8558 to your computer and use it in GitHub Desktop.
pdf creator
"niklasravnsborg/laravel-pdf": "^1.5"
$response = view("print.letter", compact("products", "date", "attachment_files", "letter_number", "content"))->render();
$pdf = new Pdf($response,
['format' => 'A4','custom_font_path' => base_path('public'), // don't forget the trailing slash!
'custom_font_data' => [
'IRANSans' => [
'R' => 'IRANSans-Bold-web.ttf', // regular font
'B' => 'IRANSans-Bold-web.ttf', // optional: bold font
'I' => 'IRANSans-Bold-web.ttf', // optional: italic font
'BI' => 'IRANSans-Bold-web.ttf' // optional: bold-italic font
],
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 10,
'margin_bottom' => 10,
'margin_header' => 0,
'margin_footer' => 0,
// ...add as many as you want.
]]);
$pdf->shrink_tables_to_fit = 0;
// $path = public_path()."\\test.pdf";
$path = dirname(dirname(public_path()))."/test.pdf";
$pdf->save($path);
"iransans-bold-web" => array(/* Korean */
'R' => "IRANSans.ttf",
'useOTL' => 0xFF,
'useKashida' => 75,
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment