Solved

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

Posted on 2010-09-06
6
3,538 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 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 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 100 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 300 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 300 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

685 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