• Resolved jonaswork

    (@jonaswork)


    Hi there!

    I saw there was an auto update on the plugin on friday, the plugin then was down completely over the weekend, think this was mostly because of a custom font I’ve integrated.

    Fatal error: Uncaught Mpdf\MpdfException: Cannot find TTF TrueType font file "Roboto-Regular.ttf" in configured font directories. in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Fonts/FontFileFinder.php:33 Stack trace: #0 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php(3889): Mpdf\Fonts\FontFileFinder->findFontFile() #1 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php(4184): Mpdf\Mpdf->AddFont() #2 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php(18323): Mpdf\Mpdf->SetFont() #3 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Tag/BlockTag.php(386): Mpdf\Mpdf->setCSS() #4 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Tag.php(240): Mpdf\Tag\BlockTag->open() #5 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php(13921): Mpdf\Tag->OpenTag() #6 /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php(199): Mpdf\Mpdf->WriteHTML() #7 /var/www/vhosts/mythenforum.ch/httpdocs/wp-includes/class-wp-hook.php(324): dkpdf_output_pdf() #8 /var/www/vhosts/mythenforum.ch/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #9 /var/www/vhosts/mythenforum.ch/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action() #10 /var/www/vhosts/mythenforum.ch/httpdocs/wp-includes/class-wp.php(830): do_action_ref_array() #11 /var/www/vhosts/mythenforum.ch/httpdocs/wp-includes/functions.php(1336): WP->main() #12 /var/www/vhosts/mythenforum.ch/httpdocs/wp-blog-header.php(16): wp() #13 /var/www/vhosts/mythenforum.ch/httpdocs/index.php(17): require('...') #14 {main} thrown in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Fonts/FontFileFinder.php on line 33

    When I copy the Roboto ttfs in the folder, it starts to work again, but the css seems not to work properly (font is not displayed and some other elements not in the right position).

    In the PDF, the following errors are also being displayed:

    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 91
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 94
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 97
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 100
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 103
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 106
    Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/w-
    p-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 109

    Also, I’ve found there Errors in the debug log:

    [07-Oct-2024 06:29:20 UTC] PHP Deprecated:  Creation of dynamic property DKPDF::$admin is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/dk-pdf.php on line 75
    [07-Oct-2024 06:34:27 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php on line 16140
    [07-Oct-2024 06:34:27 UTC] PHP Warning: Undefined array key "bgcolorarray" in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php on line 18613

    Thank you for your help!

    Jonas

    • This topic was modified 1 month, 2 weeks ago by jonaswork.
    • This topic was modified 1 month, 2 weeks ago by jonaswork.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author dinamiko

    (@dinamiko)

    Hi @jonaswork,

    Regarding strftime error in your dkpdf-index.php custom template, try to use a replacement as it’s deprecated in PHP 8.1, see available replacements here: https://php.watch/versions/8.1/strftime-gmstrftime-deprecated

    About debug logs I’ll check if there is something I can do to fix them, thanks!

    Thread Starter jonaswork

    (@jonaswork)

    Perfect, thank you so much!

    It looks like only this error remains in the log:

    [07-Oct-2024 11:58:17 UTC] PHP Deprecated: Creation of dynamic property DKPDF::$admin is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/dk-pdf.php on line 75

    Plugin Author dinamiko

    (@dinamiko)

    Hi @jonaswork,

    I’ve uploaded a new version of the plugin (1.9.8), it should remove the deprecated message, when you have time please give it a try and let me know if the message is gone, thanks!

    Thread Starter jonaswork

    (@jonaswork)

    Hi dinamiko

    Thank you for answering and solving the problem with the error message.

    I’ve updated and now the following error occur in the debug.log (seems that still something is worng with:

    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 91
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 94
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 97
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 100
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 103
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 106
    [17-Oct-2024 08:52:36 UTC] PHP Deprecated: Function strftime() is deprecated in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/themes/henrik-child/dkpdf/dkpdf-index.php on line 109
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Undefined array key "bgcolorarray" in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 18613
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 16140
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 16140
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 16140
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 16140
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Trying to access array offset on null in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 16140
    [17-Oct-2024 08:52:38 UTC] PHP Warning: Undefined array key "bgcolorarray" in /var/www/vhosts/mythenforum.ch/httpdocs/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php on line 18613

    Thanks also for the tip on fixing the strftime error, but I have no idea how to solve it (as I’m not really a developer).

    Do you have a tip? At the moment it looks like this:

                <?php
               /*
               // Evtl. brauchbar für Admin
                $seiten_url = add_query_arg($_SERVER['QUERY_STRING'], '', home_url( $wp->request ));
                $findMich   = '?pdf=';
                $pdf_Seite = strpos($seiten_url, $findMich);
                */
                $karten_titel = get_field("karten_bezeichnung");
                $karten_titel_hinweiszeile = get_field("kalenderwoche");
    
    
                //Kalenderwochen-Nr. aus Zeile extrahieren
                $year = date("Y");
                $str = $karten_titel_hinweiszeile;
                preg_match_all('!\d+!', $str, $matches);
                $week_no = $matches[0][0];
                $datetime = new DateTime();
    
                $datetime->setISODate($year,$week_no);
    
                $montag_nach_wo_nr = $datetime->modify("+0 day")->format('d-m-Y');
                $montag_deutsch = strftime("%d. %B %Y", strtotime($montag_nach_wo_nr));
    
                $dienstag_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $dienstag_deutsch = strftime("%d. %B %Y", strtotime($dienstag_nach_wo_nr));
    
                $mittwoch_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $mittwoch_deutsch = strftime("%d. %B %Y", strtotime($mittwoch_nach_wo_nr));
    
                $donnerstag_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $donnerstag_deutsch = strftime("%d. %B %Y", strtotime($donnerstag_nach_wo_nr));
    
                $freitag_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $freitag_deutsch = strftime("%d. %B %Y", strtotime($freitag_nach_wo_nr));
    
                $samstag_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $samstag_deutsch = strftime("%d. %B %Y", strtotime($samstag_nach_wo_nr));
    
                $sonntag_nach_wo_nr = $datetime->modify("+1 day")->format('d-m-Y');
                $sonntag_deutsch = strftime("%d. %B %Y", strtotime($sonntag_nach_wo_nr));
                ?>

    Thank you for your help!

    Jonas

    Plugin Author dinamiko

    (@dinamiko)

    Hi @jonaswork,

    You can use date instead of strftime, in your code example it could look like this:


    $karten_titel_hinweiszeile = '42';
    $datetime = new DateTime();
    $datetime->setISODate(date("Y"), $karten_titel_hinweiszeile);
    $montag_nach_wo_nr = $datetime->modify("+0 day")->format('d-m-Y');

    // use date instead of strftime
    $montag_deutsch = date('d. F Y', strtotime($montag_nach_wo_nr));

    echo $montag_deutsch; // 14. October 2024
    • This reply was modified 1 month ago by dinamiko.
    Thread Starter jonaswork

    (@jonaswork)

    Thank you so much for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.