In case you do not know the filename of the respective truetype fonts, just open up your fonts folder in the explorer (usually it’s c:windowsfonts) and choose View - Details. You will see something similar to the following:
The first column shows the descriptive font name, and the second column gives you the filename of the true type font. Specifying two or more fonts You can set up two or more fonts with multiple statements of pdf_set_parameter(): pdf_set_parameter($pdf, 'FontOutline', 'Arial=c:windowsfontsarial.ttf'); pdf_set_parameter($pdf, 'FontOutline', 'Times New Roman=c:windowsfontstimes.ttf'); pdf_set_parameter($pdf, 'FontOutline', 'Verdana=c:windowsfontsverdana.ttf'); followed by: $font1 = pdf_findfont($pdf, "Arial", "host", 1); $font2 = pdf_findfont($pdf, "Times New Roman", "host", 1); $font3 = pdf_findfont($pdf, "Verdana", "host", 1); Below is a complete sample code that will produce the following PDF document:
<?php # pdf_example2.php // create a new pdf document $pdf = pdf_new(); pdf_open_file($pdf, 'pdf_example2.pdf'); // start a new page (Letter size) pdf_begin_page($pdf, 612, 792); // setup font pdf_set_parameter($pdf, 'FontOutline', 'Arial=c:windowsfontsarial.ttf'); pdf_set_parameter($pdf, 'FontOutline', 'Times New Roman=c:windowsfontstimes.ttf'); pdf_set_parameter($pdf, 'FontOutline', 'Verdana=c:windowsfontsverdana.ttf'); $font1 = pdf_findfont($pdf, "Arial", "host", 1); $font2 = pdf_findfont($pdf, "Times New Roman", "host", 1); $font3 = pdf_findfont($pdf, "Verdana", "host", 1); pdf_setfont($pdf, $font1, 20); pdf_show_xy($pdf, "This is Arial at 20 pt.", 50, 680); pdf_setfont($pdf, $font2, 24); PDF_continue_text($pdf, "This is Times New Roman at 24 pt."); pdf_setfont($pdf, $font3, 36); PDF_continue_text($pdf, "This is Verdana at 36 pt."); // done pdf_end_page($pdf); pdf_close($pdf); pdf_delete($pdf); echo "pdf_example2.pdf has been generatedn"; ?>
blog comments powered by Disqus |
|
|
|
|
|
|
|