Hosting NSB Posted March 22, 2017 Share Posted March 22, 2017 Good Afternoon Everyone, I am new to WHMCS and am loving this system, I have a simple pdf change I would like to initiated, I have gone through the documentation but the php is over my head My billing department has specially made envelopes with the clear plastic on the right side of the paper, I need to switch the Invoiced To: section of the pdf invoice to the right side, as I am having to physically print some invoices and mail them. Can anyone help with this, I tried adding a table around it to push it to the right but it completely broke it. I have restored but I just need a simple way to tell the data to be right aligned instead of left Thank you in advance for anyone that can help! 0 Quote Link to comment Share on other sites More sharing options...
hubert83 Posted March 22, 2017 Share Posted March 22, 2017 HI have you read this: http://docs.whmcs.com/PDF_Invoice_Customisation otherwise i'm geussing you have to change the settings of this in invoicepdf.tpl $pdf->SetXY(15, 42); have you played around with these x and y settings? or there are plugins available. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 23, 2017 Share Posted March 23, 2017 open /templates/{Your-Template}/invoicepdf.tpl file for editing, between (approximately) line #69 and #94 change the following code (taken from v7.1.2): # Clients Details $addressypos = $pdf->GetY(); $pdf->SetFont($pdfFont, 'B', 10); $pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1); $pdf->SetFont($pdfFont, '', 9); if ($clientsdetails["companyname"]) { $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'L'); $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'L'); } else { $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'L'); if ($clientsdetails["address2"]) { $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'L'); $pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L'); if ($customfields) { $pdf->Ln(); foreach ($customfields as $customfield) { $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'L'); } } $pdf->Ln(10); with this: # Clients Details $addressypos = $pdf->GetY(); $pdf->SetFont($pdfFont, 'B', 10); $pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1, 'R'); $pdf->SetFont($pdfFont, '', 9); if ($clientsdetails["companyname"]) { $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'R'); $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R'); } else { $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R'); } $pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'R'); if ($clientsdetails["address2"]) { $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'R'); } $pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R'); $pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'R'); if ($customfields) { $pdf->Ln(); foreach ($customfields as $customfield) { $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R'); } } $pdf->Ln(10); 0 Quote Link to comment Share on other sites More sharing options...
Hosting NSB Posted March 23, 2017 Author Share Posted March 23, 2017 open /templates/{Your-Template}/invoicepdf.tpl file for editing, between (approximately) line #69 and #94 change the following code (taken from v7.1.2): # Clients Details $addressypos = $pdf->GetY(); $pdf->SetFont($pdfFont, 'B', 10); $pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1); $pdf->SetFont($pdfFont, '', 9); if ($clientsdetails["companyname"]) { $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'L'); $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'L'); } else { $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'L'); if ($clientsdetails["address2"]) { $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'L'); $pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L'); if ($customfields) { $pdf->Ln(); foreach ($customfields as $customfield) { $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'L'); } } $pdf->Ln(10); with this: # Clients Details $addressypos = $pdf->GetY(); $pdf->SetFont($pdfFont, 'B', 10); $pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1, 'R'); $pdf->SetFont($pdfFont, '', 9); if ($clientsdetails["companyname"]) { $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'R'); $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R'); } else { $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R'); } $pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'R'); if ($clientsdetails["address2"]) { $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'R'); } $pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R'); $pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'R'); if ($customfields) { $pdf->Ln(); foreach ($customfields as $customfield) { $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R'); } } $pdf->Ln(10); Thank you so much that did the trick! 0 Quote Link to comment Share on other sites More sharing options...
Hosting NSB Posted March 23, 2017 Author Share Posted March 23, 2017 Thank you so much! This worked perfectly! 0 Quote Link to comment Share on other sites More sharing options...
Hosting NSB Posted March 23, 2017 Author Share Posted March 23, 2017 Ok now my office is asking if we can move it a little more in, so a margin to the right just a bit, trying to make it fit this envelope they have thousands of made, is this an easy fix? thank you so much for all you have helped with so far! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 23, 2017 Share Posted March 23, 2017 sure, add the following line after the opening <?php in the same file $pdf->SetRightMargin(10); or $pdf->SetRightMargin(5); 0 Quote Link to comment Share on other sites More sharing options...
Hosting NSB Posted March 23, 2017 Author Share Posted March 23, 2017 Ok now it looks like I need to push it up higher too, is it possible to have it swapped with the details of my company? I am trying to do it on my own now with some interesting results! - - - Updated - - - thank I will try that for the margins 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.