php - Adding vertical text into existing pdf


I am trying to modify an existing pdf, adding datas into it using FPDI and FPDF. So far everything is fine. The only thing I am stuck at is inserting vertical text into the pdf.

Tried searching online, but non of the codes really worked.



I tried this, but this doesnt work together with FPDI, i.e I can generate new pdfs with verical or angled texts. But what I am trying to do is to insert vertical text into the already exisitng pdf. Unfortunately, FPDF doesnt allow to set source file. FPDI does, but this code isnt working together with FPDI somehow.




The quoted code is extracted from this extension. The extension will work with FPDI as with FPDF by changing its extending class name as described here.

So the extension class definition will become e.g.:

class PDF_Rotate extends FPDI

And you can still use the methods of FPDI:

$pdf = new PDF_Rotate();
$pageCount = $pdf->setSourceFile("template.pdf");
$tplIdx = $pdf->importPage(1);
$pdf->Rotate(100, 60, 90);
$pdf->Text(100, 60, 'Hello!');

People are also looking for solutions to the problem: More elegant way of looping through array and aggregating result in PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.