$amount = "AMOUNTS S(\$)"; $line = "____________________________________________________________________________________________"; $debit = "DEBIT CARD: "; $amex = "AMERICAN EXPRESS CARD: "; $visa = "VISA CARD: "; $staffsalary = "STAFF SALARY: "; $phonebill = "PHONE BILL: "; $rental = "RENT BILL: "; $electric = "ELECTRICITY BILL: "; $director = "DIRECTOR'S FEE: "; $consignment = "CONSIGNMENT AMOUNT: "; $descript = "DESCRIPTION: "; $total = "TOTAL EXPENDITURE AMOUNT:"; $doubleline = "================================================"; //PRINTING -------------------------------------------------------------- PDF_fit_image($pdf, $images, 20, 760, ""); PDF_show_xy($pdf, $header, 230, 790); PDF_show_xy($pdf, $reference, 460, 770); PDF_show_xy($pdf, "{$timestamp['mday']}/{$timestamp['mon']}/{$timestamp['year']} {$timestamp['hours']}:{$timestamp['minutes']}", 460, 750); PDF_show_xy($pdf, $reportl1, 20, 740); PDF_show_xy($pdf, $reportl2, 20, 720); PDF_show_xy($pdf, "EXPENDITURE ID: " . $expenditure_id, 20, 670); PDF_show_xy($pdf, $description, 20, 650); PDF_show_xy($pdf, $amount, 450, 650); PDF_show_xy($pdf, $line, 20, 645); $x = 20; $y = 655; PDF_show_xy($pdf, $debit, $x, $y - 30); PDF_show_xy($pdf, $amex, $x, $y - 60); PDF_show_xy($pdf, $visa, $x, $y - 90); PDF_show_xy($pdf, $staffsalary, $x, $y - 120);
PDF_set_parameter($p, "SearchPath", $searchpath); /* open new PDF file; insert a file name to create the PDF on disk */ if (PDF_open_file($p, "") == 0) { die("Error: " . PDF_get_errmsg($p)); } /* This line is required to avoid problems on Japanese systems */ PDF_set_parameter($p, "hypertextencoding", "winansi"); PDF_set_info($p, "Creator", "image.php"); PDF_set_info($p, "Author", "Rainer Schaaf"); PDF_set_info($p, "Title", "image sample (PHP)"); $imagefile = "nesrin.jpg"; $image = PDF_load_image($p, "auto", $imagefile, ""); if (!$image) { die("Error: " . PDF_get_errmsg($p)); } /* dummy page size, will be adjusted by PDF_fit_image() */ PDF_begin_page($p, 10, 10); PDF_fit_image($p, $image, 0, 0, "adjustpage"); PDF_close_image($p, $image); PDF_end_page($p); /* close page */ PDF_close($p); /* close PDF document */ $buf = PDF_get_buffer($p); $len = strlen($buf); header("Content-type: application/pdf"); header("Content-Length: {$len}"); header("Content-Disposition: inline; filename=image.pdf"); print $buf; PDF_delete($p); /* delete the PDFlib object */