pdf_export

function yang dipanggil ketika ingin membuat file pdf

pdf_export($config, $title = 'new-file');

  • $config: Array untuk konfigurasi file pdf yang akan dibuat, untuk lebih jelas nya anda bisa mengunjungi http://pdfmake.org/playground.html
  • $title: String nama file untuk hasil pdf yang dibuat
Contoh penggunaan:
$config = array(
	'content' => array(
		array(
			'text'  => 'Judul PDF yang ingin dibuat',
			'style' => 'title'
			),
		array(
			'columns' => array(
				array(
					'text'  => 'Danang Widiantoro',
					'style' => 'author'
					),
				array(
					'text'  => 'May 4th, 2016 03:11:39',
					'style' => 'created'
					)
				),
			),
		array(
			'image' => 'sampleImage.jpg',
			'style' => 'image',
			'width' => 520
			),
		array(
			'text'  => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.',
			'style' => 'content'
			),
		array(
			'text'  => 'Terakhir disunting : May 21st, 2016 16:46:2',
			'style' => 'modified'
			),
		array(
			'text'  => 'Tags : Article, Berita, Information',
			'style' => 'category'
			),
		),
	'styles' => array(
		'title'    => array(
			'fontSize' => 18,
			'bold'     => true,
			'margin'   => [0,0,0,20]
			),
		'author'   => array(
			'italic' => true
			),
		'created'  => array(
			'italic'    => true,
			'alignment' => 'right'
			),
		'image'    => array(
			'alignment' => 'center',
			'margin'    => [0,0,0,10]
			),
		'content'  => array(
			),
		'modified' => array(
			'italic'    => true,
			'alignment' => 'right',
			'margin'    => [0,10,0,0]
			),
		'category' => array(
			'italic'    => true,
			'margin'    => [0,20,0,0]
			),
		),
	'pageSize'        => 'a4',
	'pageOrientation' => 'portrait'
	);
_func('pdf');
pdf_export($config, $config['title']);

 

File Path: includes/function/pdf.php function untuk konversi data menjadi PDF

0 Comment

Post Your Comment

Terakhir Dilihat