rahman_akon18
rahman_akon18

Reputation: 346

How to add copyright symbol in FPDF?

I want to add a cell in a generated PDF with a copyright symbol .But adding the cell output shows some unwanted symbol at the beginning. Need a solution on this.

function Footer {
$this->SetTextColor(96,96,96);
$this->SetFont('Times','B',12);
$this->Cell(0,5,'abc Limited',0,2,'C',0);
$this->Cell(50,5,'',0,2,'C',0);
$this->Cell(0,5,'this is address',0,2,'C',0);
$this->Cell(188,5,'','B',1,'c',0);  
$this->Cell(50,5,'',0,2,'C',0); 
$this->Cell(0,5,  '©All rights reserved abc Ltd',0,1,'C',0);
}

Upvotes: 4

Views: 5398

Answers (4)

DevSteam
DevSteam

Reputation: 10

Use this simple, no need to add function footer:

<?php
//assume $MainPayment is a company
$MainPayment = 'Your Company';


// previous FPDF and linked library
//.. here...
$pdf->Cell(0, 8, "Copyright \xA9 $currentYear $MainPayment All rights reserved.", 0, 1, 'C');

?>

Upvotes: 0

xtempore
xtempore

Reputation: 5505

I tried the "&#169" suggestion and all it showed was literally "&#169", so I tried some other options. Just simple chr worked fine...

$this->Cell(0, 5, chr(169) . ' All rights reserved, etc', 0, 1, 'C', 0);

Upvotes: 7

rahman_akon18
rahman_akon18

Reputation: 346

function Footer {   
    $this->Cell(0,5,iconv("UTF-8", "ISO-8859-1", "©").'All rights  reserved     
Ltd.',0,1,'C',0);
}

Upvotes: 2

Buendiadas
Buendiadas

Reputation: 851

You have 2 choices:

  1. Encode your document in utf-8 from your text Editor.

  2. Use directly the Unicode Html entity &#169.This would turn your code into:

    <?php $this->Cell (0'5, '&#169 All rights reserved blahblah');?>

Upvotes: 1

Related Questions