OiO.lk Blog pdf Using FPDF AND FPDI . WANT TO ROTATE CONTENT 1/2 WAY DOWN ON ONE PAGE
pdf

Using FPDF AND FPDI . WANT TO ROTATE CONTENT 1/2 WAY DOWN ON ONE PAGE


Have successfully implements fpdf, fpdi and the advanced fpdi parser. Doing’s it job really well.

BUT I have a form, created by others, that one of the page has a graphic and text embedded, half way down rotated 90 degrees. I need to rotate that content or even move that section of the page to another part of the PDF, emptying that section it originally resides in.

This is my present code, what would you suggest I do to make this change?

use \setasign\Fpdi\Fpdi;
use setasign\Fpdi\PdfParser\StreamReader;

function mmd_CreatePDFResultsOffical( $pdf, $DbId, $ListId, $Email, $bOutput )
{
require_once(plugin_dir_path( __FILE__ ).'pdf/fpdf.php');
require_once(plugin_dir_path( __FILE__ ).'fpdi/src/autoload.php');
require_once(plugin_dir_path( __FILE__ ).'fpdi/fpdi_pdf-parser2/src/autoload.php'); 
        

// saves the file locally

$FileName = plugin_dir_path( __FILE__ ). FileName';
$Status = file_put_contents('localFile.pdf', file_get_contents($FileName ));
if($Status == FALSE )
{
    return NULL;
}

$pdf = new Fpdi();
$pageCount = $pdf->setSourceFile('localFile.pdf');

$templateId = $pdf->importPage(1);
$size = $pdf->getTemplateSize($templateId);


$pdf->AddPage('P', 'Legal');
$PageHeight = $pdf->GetPageHeight();
$PageBreakTrigger = $PageHeight - 12;

$pdf->useTemplate($templateId); 
$pdf->SetFont('Arial','',10);
$pdf->SetTextColor(255,0,0); 
$pdf->SetXY(25, 25); 
$pdf->Write(0, ""); 


/// NEED TO ROTATE THE CONTENT 1/2 WAY DOWN ON THIS PAGE
$templateId = $pdf->importPage(2);
$size = $pdf->getTemplateSize($templateId);
$pdf->AddPage('P', 'Legal');
$PageHeight = $pdf->GetPageHeight();
$pdf->useTemplate($templateId); 
$pdf->Write(0, ""); 

unlink('localFile.pdf');
  
return $pdf;
}



You need to sign in to view this answers

Exit mobile version