Skip to content

Arabic text lines reversed. #18

@MohamedSaid99-Dev

Description

@MohamedSaid99-Dev

In a table cell or a paragraph (not always happen in paragraph), If it has many lines in arabic, it will be written from bottom to top.

I tried adding dir="rtl" and style="direction: rtl;" and it didn't fix it.

An example:


    if (!class_exists('GPDF')) {
        require_once __DIR__ . '/vendor/autoload.php';
    }
    ob_start();
    
    ?>
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
            <table>
                <tr>
                    <td>
                        تُعدّ اللغة العربية واحدة من أقدم اللغات السامية وأكثرها استخدامًا في العالم. تتميّز بتراكيبها الغنية، وصرفها المعقّد، وجمال حروفها التي تُكتب من اليمين إلى اليسار. تعتمد العربية على نظام الجذور الثلاثية الذي يمنحها قدرة كبيرة على الاشتقاق والتعبير، مما يجعلها لغة مرنة وقادرة على مواكبة مختلف التطورات العلمية والثقافية.
                    </td>
                    <td>
                        مع تطور التكنولوجيا وانتشار الإنترنت، ازدادت الحاجة إلى المحتوى الرقمي باللغة العربية بشكل ملحوظ. يسعى العديد من المطورين والمصممين إلى دعم العربية في مواقعهم وتطبيقاتهم لضمان وصول أفضل إلى المستخدمين الناطقين بها. كما أصبحت أدوات الترجمة وتحليل النصوص العربية أكثر دقة وكفاءة، مما يُسهّل عملية التواصل ونقل المعرفة بين الثقافات.
                    </td>
                </tr>
            </table>
    </body>

    <?php
    $html = ob_get_clean();

    $gpdfConfigFile = require_once 'config/gpdf.php';
    
    $config = new Omaralalwi\Gpdf\GpdfConfig($gpdfConfigFile);
    $pdf = new Omaralalwi\Gpdf\Gpdf($config);

    $pdfContent = $pdf->generate($html);
    $filename = 'Example.pdf';

    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    header('Content-Length: ' . strlen($pdfContent));
    header('Cache-Control: private, max-age=0, must-revalidate');
    echo $pdfContent;
    exit;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions