0

The admins wants to update the format/content of the pdf being generated for the school contract. After changing the link from production into development, I got this error saying "Required parameter $currentfont follows optional parameter $isunicode". That's why I cant view or change the pdf's content.

this is the production/live url for viewing the pdf

<a href="https://example.site.edu/contract/pdf/'.$contract_lists->id.'/'.$semester.'/'.$schoolyear.'"><button type="button" class="btn btn-info btn-rounded"><i class="fas fa-file-pdf"></i> Contract</button></a>

and after changing the link into development

 <a href="'.URL::route('contract.pdf', ['id' => $contract_lists->id, 'semester' => $semester, 'schoolyear' => $schoolyear, 'type' => $contract_lists->category]).'" target="_blank"><button type="button" class="btn btn-secondary btn-rounded"><i class="fas fa-file-pdf"></i> Contract</button></a>

it starts throwing this error. Does my PHP version have something to do with it?

  • 1
    before the changes, did the code run on your development environment? it'd best to have a working copy **before** making any changes. that error sounds like the pdf library had a breaking change, unrelated to the `href` thingies. – Bagus Tesa Jul 17 '23 at 01:21
  • I don't really know because I just inherited this code after being hired by the university. Unfortunately, there is no documentation or any other resources available, making it extremely difficult for me to locate the files associated with this process. I have relied on methods that I used in my previous Laravel projects, but this error is something I have encountered for the first time. Even after spending days searching for a solution, I still have no idea how to fix it. – CaptainCRAZY Jul 17 '23 at 01:26
  • 1
    i've been there myself with some old and obscure technology (such as Adobe CQ). however, it is imperative to have a working copy. if you had to, make copy of the production server codes and compare it with what you have at hand. we can't exactly help you if you can't help us understand the underlying problem. though, a quick google shows it [related to PHP 8 deprecations](https://github.com/tecnickcom/TCPDF/issues/222). and a more [in depth explanation](https://stackoverflow.com/a/65297280). maybe the server is not even PHP 8 while yours are? see if you can check that one. – Bagus Tesa Jul 17 '23 at 01:34
  • I believe I have identified the problem. I am currently using PHP version 8.0.19, but the server's version is 7.2. The error is occurring in PHP 8. Now, I am in the process of searching for solutions to fix this issue. Would it be advisable for me to downgrade from PHP 8 to PHP 7? – CaptainCRAZY Jul 17 '23 at 01:38
  • 2
    First: consider upgrading PHP on the server **later on**. Second: start with your drv server the same as your production server, it will prevent "it works on my machine", which is actually what was happening. Third: optional and required parameters is a thing of PHP8. Check the parameters of that function. The order of those parameters (and if they have default values) are important, but just show then in your original question. – UnderDog Jul 17 '23 at 01:43
  • Thanks for all the advice everyone. I appreciate it. – CaptainCRAZY Jul 17 '23 at 01:48

0 Answers0