Solved

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

Posted on 2010-09-06
6
3,438 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now