Solved

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

Posted on 2010-09-06
6
3,501 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
PHP Soap Server returning XML but < & > as &lt; / &gt; 9 45
php help 34 58
How to set the Tinymce Editor image path 4 22
PHP Curl to output a url 7 46
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 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