1--
http://sourceforge.net/projects/tcpdf/files/ adresinden
http://sourceforge.net/projects/tcpdf/f ... p/download dosyasını indirin...
2--
indirdiginiz zip dosyasının içindeki tcpdf klasörünü joomla libraries klasörünün içine yükleyin.. libraries/tcpdf
3--
libraries/joomla/document klasörünün içindeki html klasörünü kopyalayın ve aynı dizine yapıştırın klasörün adını pdf olarak değiştiirin.
libraries/joomla/document/pdf klasörünün içindeki html.php dosyasının adını pdf.php olarak değiştirin
4--
pdf.php dosyasını açın içindeki tüm kodları silin ve aşağıdaki kodları yapıştırın.
Kod: Tümünü seç
<?php
require_once(JPATH_LIBRARIES.'/joomla/document/html/html.php');
jimport('joomla.filesystem.file');
require_once(JPATH_LIBRARIES.'/tcpdf/examples/tcpdf_include.php');
require_once(JPATH_LIBRARIES.'/tcpdf/tcpdf.php');
define ('PDF_HEADER_STRING2', "Abdulkadir LEVENT - leventler.com\nwww.leventler.net");
class JDocumentpdf extends JDocumentHTML{
private $engine = null;
private $name = 'Leventler';
function __construct($options = array()) {
parent::__construct($options);
//set mime type
$this->_mime = 'application/pdf';
//set document type
$this->_type = 'pdf';
if (!$this->iniMyPdf()) {
//JError::raiseError(500, 'PDF kütüphanesi Bulunamadı...');
echo('<b>HATA!</b> PDF kütüphanesi Bulunamadı...');
}
}
protected function iniMyPdf() {
$file = JPATH_LIBRARIES.'/tcpdf/tcpdf.php';
if (!JFile::exists($file))
{
return false;
}
require_once($file);
$this->engine = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
return true;
}
public function setName($name = 'Leventler') {
$this->name = $name;
}
public function getName() {
return $this->name;
}
function render($cache = false, $params = array()) {
$pdf = $this->engine;
$data = parent::render();
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Abdulkadir LEVENT');
$pdf->SetTitle('Leventler Asansör');
$pdf->SetSubject('Abdulkadir DENEME');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Abdulkadir LEVENT', PDF_HEADER_STRING2);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, 27, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(5);
$pdf->SetFooterMargin(10);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 15);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if ( @ file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('dejavusans', '', 10);
// add a page
$pdf->AddPage();
$pdf->writeHTML($data, true, false, true, false, '');
$pdf->lastPage();
// tarayıcının dosyayı direk indirmesini istiyorsanız bu satırı kullanın
//$pdf->Output($this->getName, 'D');
//dosyayı tarayıcı indirmeden açsın istiyorsanız bu satırı kullanın
$pdf->Output($this->getName, 'I');
return '';
}
}
/components/com_content/views/article/ klasörünün içindeki view.html.php dosyasını kopyalayın aynı dizine yapıştırın adını view.pdf.php olarak değiştirin.
Artık içerikleri pdf olarak kaydetmeye hazırız
şimdi sıra menülere pdf kaydetmek için linkleri eklemeye geldi
6--
components/com_content/helpers/icon.php dosyasını açın ve aşagıdaki kaodları ekleyin
Kod: Tümünü seç
public static function pdf($article, $params, $attribs = array(), $legacy = false)
{
$uri = JUri::getInstance();
$base = $uri->toString(array('scheme', 'host', 'port'));
$link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false);
$url = $link.'?tmpl=component&format=pdf';
$text = JHtml::_('image', 'system/pdf_button.png', ' Pdf '.JText::_('JSAVE'), NULL, true).' Pdf '.JText::_('JSAVE');
$output = JHtml::_('link', JRoute::_($url), $text);
return $output;
}
/layouts/joomla/content/icons.php dosyasını açın ve aşagıdaki kaodları <ul class="dropdown-menu"> ---- </ul> kodlarının arasına ekleyin.
Kod: Tümünü seç
<?php /* -------PDF LINK--------------- */ ?>
<li class="print-icon"> <?php echo JHtml::_('icon.pdf', $displayData['item'], $displayData['params']); ?> </li>
<?php /* -------PDF LINK---END--------- */ ?>
Umarım faydalı olmuştur...
Joomla 3.3 te denenmiş sonuç başarılı olmuştur.
NOT: Joomlayı güncellerseniz bu işlemleri tekrar baştan yapmanız gerekebilir güncellemeden önce yedeklerinizi almanızı tavsiye ederim...
SAYGILAR....