diff --git a/PaperPDF.php b/PaperPDF.php new file mode 100644 index 0000000..55bba9e --- /dev/null +++ b/PaperPDF.php @@ -0,0 +1,24 @@ +Image($logo_url, 10, 10, 50, '', '', '', 'T', false, 300, '', false, false, 0, false, false, false); + } + $this->SetFont('helvetica', 'B', 20); + $this->Cell(0, 15, get_bloginfo('name'), 0, false, 'C', 0, '', 0, false, 'T', 'M'); + $this->Ln(20); + } + + // Page footer + public function Footer() { + $this->SetY(-15); + $this->SetFont('helvetica', 'I', 8); + $this->Cell(0, 10, 'Page ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); + } +} \ No newline at end of file diff --git a/functions.php b/functions.php index 4f77824..e0e8bcc 100644 --- a/functions.php +++ b/functions.php @@ -775,6 +775,8 @@ function handle_pdf_download() } if (is_tcpdf_available()) { + require_once get_template_directory() . '/PaperPDF.php'; + $post_id = get_query_var('download_pdf'); if ($post_id && is_numeric($post_id)) { @@ -782,7 +784,7 @@ function handle_pdf_download() if ($post && $post->post_type == 'article') { // Create new PDF document - $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); + $pdf = new PaperPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // Set document information $pdf->SetCreator(PDF_CREATOR);