Skip to content

PHP HTML-to-PDF Converter with UTF-8 Support (Chinese, Japanese, European, etc.)

License

Notifications You must be signed in to change notification settings

HoldOffHunger/php-html-to-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PHP HTML-to-PDF Converter with UTF-8 Support

(supports Chinese, Japanese, European, etc.)

This project provides a simple, easy-to-use HTML-to-PDF converter in PHP, with full, out-of-the-box support for UTF-8 and non-Latin-based languages.

Demos

Dependencies

PHP HTML-to-PDF Converter makes use of :

  • tFPDF (based on FPDF 1.7)
  • FPDF ("Free PDF")
  • DejaVu Language Pack
  • ZCOOL_QingKe_HuangYou Chinese Language Pack
  • rounded-mgenplus-20140828 Japanese Language Pack

Sample Use

English Example

	require('../php-html-to-pdf/php-html-to-pdf.php');
	
	$pdf_object = new HTMLtoPDF([
		'Author'=>'HoldOffHunger',
		'Title'=>'Privacy Policy',
	]);
		
	$pdf_object->WriteHTML([
		'html'=>'<h1>I can say hello in English!</h2><p>Hello!</p>',
		'language'=>'en',
	]);

	$pdf_object->Output('file.pdf', "F", TRUE);

Japanese Example

	require('../php-html-to-pdf/php-html-to-pdf.php');
	
	$pdf_object = new HTMLtoPDF([
		'Author'=>'HoldOffHunger',
		'Title'=>'Privacy Policy',
	]);
		
	$pdf_object->WriteHTML([
		'html'=>'<h1>I can say hello in 日本人!</h2><p>こんにちは!</p>',
		'language'=>'ja',
	]);

	$pdf_object->Output('file.pdf', "F", TRUE);

Chinese Example

	require('../php-html-to-pdf/php-html-to-pdf.php');
	
	$pdf_object = new HTMLtoPDF([
		'Author'=>'HoldOffHunger',
		'Title'=>'Privacy Policy',
	]);
		
	$pdf_object->WriteHTML([
		'html'=>'<h1>I can say hello in 汉语!</h2><p>你好!</p>',
		'language'=>'zh',
	]);

	$pdf_object->Output('file.pdf', "F", TRUE);

About

PHP HTML-to-PDF Converter with UTF-8 Support (Chinese, Japanese, European, etc.)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published