اذهب إلى المحتوى
  • 0

اسئلة عن محاذاة الصور في مكتبة TCPdf

محمد المصري12

السؤال

سلام عليكم

السؤال الاول كنت قد سألته و لم اتلق ردا و هو كيف اضبط الصورة داخل خليه الجدول لانها تظهر بخارجة كما بالصورة التالية

https://academy.hsoub.com/uploads/monthly_2021_03/Untitled-2.jpg.5f9362a481f21caaac22cc90c915af61.jpg

الكود اهو

// Write Contect here

$html = '<table align="center" dir="rtl" style="width: 90%; border-collapse: collapse; border: 1px solid #000000">
	<tr>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		محمد</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		الاهلي</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		محمد</td>
	</tr>
	<tr>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		<img alt="" height="168" src="https://www.majorgeeks.com/images/logos/majorgeeks.gif" width="172" /></td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
	</tr>
	<tr>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
	</tr>
	<tr>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
		<td colspan="3" dir="rtl" style="text-align: center; border-left: 1px solid #C0C0C0; border-right-style: solid; border-right-width: 1px; border-top: 1px solid #C0C0C0; border-bottom-style: solid; border-bottom-width: 1px">
		&nbsp;</td>
	</tr>
</table>

';
$pdf->SetFont('tahoma', '', 10);
$pdf->SetXY(60,70);

$pdf->writeHTML($html, true, false, true, false, '');

و بيانات الاستدعاء كالتالي

class MYPDF extends TCPDF {

    //Page header
    public function Header() {

        // Set font
//        $this->SetFont('tahoma', '', 20, 'B', false);
        // Title
//        $this->Cell(190,12,"الملف الفني التلقائي",1,1,'C');


    }

    // Page footer
    public function Footer() {
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font
        $this->SetFont('tahoma', 'I', 6);
        // Page number
//        $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
        $this->Cell(0, 10, 'Powered By GTMS - الريادة لنظم المعلومات', 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }
}

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

 

السؤال الثاني 

كيف يمكنني ادخال صورة بدلا من النص في الكود التالي بحيث الصورة تاخد ابعاد الخلية يكون حد العرض الاقصى لها مهما بلغ حجمها هو عرض الخلية و كذلك الطول 

$pdf->Cell(30,10,"الوصف",1,0,'C',1);

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

بخصوص الصورة يمكنك تغيير موضعها من مكان لأخر عن طريق خاصية margin باستخدام css. 

بخصوص السؤال الثاني يمكنك استخدام writeHTMLCell بهذا الشكل 

$pdf->writeHTMLCell(100, 50, 10, 10, 'Lorem ipsum... <img src="..." />');

يرجى إرفاق ملفات مشروعك كاملاً إذا لم ينجح الامر معك لنساعدك في ذلك.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

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

×   جرى استعادة المحتوى السابق..   امسح المحرر

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

  • إعلانات

  • تابعنا على



×
×
  • أضف...