Jump to content

Invoice PDF, layout customization


amil

Recommended Posts

Hello,

 

I am trying to make some customizations on pdf layout for invoices (invoicepdf.tpl file).

 

I refer vertical line text on left part, like this:

 

custominvoice.png

 

I think for this, i need to setup a new "custom field" and set "show on invoice" (no issues to set a fixed text on invoicepdf.tpl file directly).

 

But the question, is i am absolutely unable to edit sucesfully invoicepdf.tpl file to make the changes, when i set some code on file, it breaks pdf generation so definetively my code break it and a bit frustrating...

 

Thanks in advance for all help and suggestions :)

Link to comment
Share on other sites

sentq really i am now in the right direction! That is just all i need! :)

 

But i can see some issues when i try to fit my needs, for example with your code the invoice pdf is:

 

example1.png

 

I set a $pdf->Rotate(90); to change text orientation, but unfortunately (and unexpected to me -text orientation is okay now,but not the adjustment) the result is:

 

example2.png

 

This should appears from bottom-to-top but you can see its appears on top of pdf.

 

 

Thank you so much!!

Link to comment
Share on other sites

you could try tweaking sentq's code by replacing his Rotate line with....

 

$pdf->Rotate(90,105,125);

also, you shouldn't need a custom field for this... if your invoices are just in one language for all customers, then just add the text into the invoice template... if you need this line to be in the client's language, then use Language Overrides and reference them in the invoicepdf.tpl code, e.g - $_LANG["invoicesdatedue"]

Link to comment
Share on other sites

brian! really thank you!

 

Only a last thing to definetively finish te customization :)

 

This is the result, with your $pdf->Rotate(90,105,125);

 

result1.png

 

This is nice, but it would be great if text can start at bottom of the invoice, like this:

 

shouldbe.png

 

I am unable to alter the coords and get a sucessfully result.

 

Thank you so much again :)

Link to comment
Share on other sites

I think the easiest way to do that would be to centre the text (so change 'L' to 'C') and then add spaces to the text string to lengthen the output...

 

$pdf->SetXY(5,25);
$pdf->StartTransform();
$pdf->Rotate(90,105,125);  
$pdf->Cell(0,0,'There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don\'t look even...                                      ',0,0,'C',0,'');
$pdf->StopTransform();
$pdf->SetMargins(20, 10, 10, true); 

once you change the above text string to suit your own needs, you may need to play with the number of spaces used to centre it vertically.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated