Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to make pdf using php and fpdf  that support special font

Posted on 2010-09-06
6
Medium Priority
?
3,740 Views
Last Modified: 2013-12-13
hi all,
i have downloaded fpdf class from http://fpdf.org/ and tested it it works fine but it cann't make arabic text or using special font like kasct poster when it try it i get the following error

Warning: FPDF::include(./kacstposter.php) [function.FPDF-include]: failed to open stream: No such file or directory in /data/html/work/php_good_parts/fpdf16/fpdf.php on line 467

Warning: FPDF::include() [function.include]: Failed opening './kacstposter.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /data/html/work/php_good_parts/fpdf16/fpdf.php on line 467
FPDF error: Could not include font definition file

what is the font definition file is and how can i get it for a certain font

can you please guide me
thanks in advance

shangyhi2000
0
Comment
Question by:shangyhi2000
6 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 total points
ID: 33612298
This page shows how to make it work: http://fpdf.org/en/tutorial/tuto7.htm
0
 
LVL 3

Assisted Solution

by:ovi_mihai
ovi_mihai earned 400 total points
ID: 33612910
Download the ttp2pt1 from: http://www.fpdf.org/fr/dl.php?id=22

you have to create some files (afm, php and z) with a line like

ttf2pt1 -a yourfont.ttf yourfont

put the files you got in the same folder as the folowing script
then write a script
<?php
define('FPDF_FONTPATH','./');
require('fpdf.php');

$pdf=new FPDF();
$pdf->AddFont('Calibri','','calibri.php');
$pdf->AddPage();
$pdf->SetFont('Calibri','',35);
$pdf->Cell(0,10,'Enjoy new fonts with FPDF!');
$pdf->Output();
?>

like dave said, read from the tutorial, i've tested it and it works.

see turorial/tuto7.html and tutorial/tuto7.php  from the zip file yo already got
0
 
LVL 7

Assisted Solution

by:Vimal DM
Vimal DM earned 1200 total points
ID: 33624268
Hai,

1) There are PDF classes are available to export the records into PDF
2) And there are FPDF + PDF classes are available to make the entries to the PDF templates,which will give the PDF Template as FPDF then using an exe can convert the FPDF to PDF.

If you want can give u the implemented soruce

Thanks.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shangyhi2000
ID: 33648828
dear DaveBaldwin, ovi_mihai, vimalmaria,
i tryed what you said but when i try the attached code it display garbage
also when i try makefont.php i get warnings here it is :

Warning: character hyphen is missing
Warning: character Euro is missing
Warning: character afii57506 is missing
Warning: character dagger is missing
Warning: character daggerdbl is missing
Warning: character afii57511 is missing
Warning: character afii57507 is missing
Warning: character afii57508 is missing
Warning: character afii57512 is missing
Warning: character afii57509 is missing
Warning: character emdash is missing
Warning: character afii57513 is missing
Warning: character afii61664 is missing
Warning: character afii301 is missing
Warning: character afii57514 is missing
Warning: character afii57388 is missing
Warning: character hyphen is missing
Warning: character mu is missing
Warning: character afii57403 is missing
Warning: character afii57407 is missing
Warning: character afii57409 is missing
Warning: character afii57410 is missing
Warning: character afii57411 is missing
Warning: character afii57412 is missing
Warning: character afii57413 is missing
Warning: character afii57414 is missing
Warning: character afii57415 is missing
Warning: character afii57416 is missing
Warning: character afii57417 is missing
Warning: character afii57418 is missing
Warning: character afii57419 is missing
Warning: character afii57420 is missing
Warning: character afii57421 is missing
Warning: character afii57422 is missing
Warning: character afii57423 is missing
Warning: character afii57424 is missing
Warning: character afii57425 is missing
Warning: character afii57426 is missing
Warning: character afii57427 is missing
Warning: character afii57428 is missing
Warning: character afii57429 is missing
Warning: character afii57430 is missing
Warning: character afii57431 is missing
Warning: character afii57432 is missing
Warning: character afii57433 is missing
Warning: character afii57434 is missing
Warning: character afii57440 is missing
Warning: character afii57441 is missing
Warning: character afii57442 is missing
Warning: character afii57443 is missing
Warning: character afii57444 is missing
Warning: character afii57445 is missing
Warning: character afii57446 is missing
Warning: character afii57470 is missing
Warning: character afii57448 is missing
Warning: character afii57449 is missing
Warning: character afii57450 is missing
Warning: character afii57451 is missing
Warning: character afii57452 is missing
Warning: character afii57453 is missing
Warning: character afii57454 is missing
Warning: character afii57455 is missing
Warning: character afii57456 is missing
Warning: character afii57457 is missing
Warning: character afii57458 is missing
Warning: character afii299 is missing
Warning: character afii300 is missing
Warning: character afii57519 is missing
Font file compressed (kacst.z)
Font definition file generated (kacst.php)

attached the code and the font at   http://softpro.bz/test.zip
0
 
LVL 7

Accepted Solution

by:
Vimal DM earned 1200 total points
ID: 33674320
Hai,

You may look at the following url,download the source and see what is done there,you may get some ideas out of it.

http://www.ros.co.nz/pdf/

Thanks,
0
 

Author Closing Comment

by:shangyhi2000
ID: 33813211
answer is not responsive
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question