feat(pdf): improve PDF title rendering and margins

Adjusted PDF title rendering to use HTML for better styling.
Set top margin to 50 units for improved layout consistency.

This improves the visual presentation of PDF titles, adhering more closely to typographical standards.
This commit is contained in:
Kumi 2024-08-02 22:18:58 +02:00
parent 77949dd0c1
commit 934db5dcc4
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -791,13 +791,14 @@ function handle_pdf_download()
$pdf->SetAuthor(get_bloginfo('name')); $pdf->SetAuthor(get_bloginfo('name'));
$pdf->SetTitle($post->post_title); $pdf->SetTitle($post->post_title);
$pdf->SetSubject('Scientific Paper'); $pdf->SetSubject('Scientific Paper');
$pdf->SetMargins(PDF_MARGIN_LEFT, 50, PDF_MARGIN_RIGHT);
// Add a page // Add a page
$pdf->AddPage(); $pdf->AddPage();
// Set title // Set title
$pdf->SetFont('helvetica', 'B', 20); $pdf->SetFont('helvetica', 'B', 20);
$pdf->Cell(0, 10, $post->post_title, 0, 1, 'C'); $pdf->writeHTML('<h1>' . $post->post_title . '</h1>', true, false, false, false, 'C');
// Set authors // Set authors
$pdf->SetFont('helvetica', '', 12); $pdf->SetFont('helvetica', '', 12);