0
我想为公共汽车代理商在左上方标注他们的徽标,地址在右上角。然后在中间他们的信息名称,姓氏,destinatin,成本..等 然后在底部也许一些更多的信息.. 这将需要很多时间来建立这个,但我想也许有一个地方已经存在为此,我需要你的帮助,如果有人知道,那么我会腾出很多时间。来自php的pdf发票
谢谢你的时间和帮助。
我想为公共汽车代理商在左上方标注他们的徽标,地址在右上角。然后在中间他们的信息名称,姓氏,destinatin,成本..等 然后在底部也许一些更多的信息.. 这将需要很多时间来建立这个,但我想也许有一个地方已经存在为此,我需要你的帮助,如果有人知道,那么我会腾出很多时间。来自php的pdf发票
谢谢你的时间和帮助。
我使用FILE_PDF PHP库做了类似的事情。这需要在dates[]
或hours[]
表单POST数据,并以表it.Here的我的一些代码罢了,它不是完美的,但它可能给你一个开始
$tasks = array("dates","descriptions","hours","minutes");
foreach($tasks as $name)
{
$$name = explode("\n",$_POST[$name]);
}
for ($i=0;$i<count($descriptions);$i++)
{
$data[]=array("dates"=>$dates[$i],"descriptions"=>$descriptions[$i],"hours"=>$hours[$i],"minutes"=>$minutes[$i]);
}
$p = &File_PDF::factory('P','mm','A4');
$p->open();
$p->setMargins(25, 25);
$p->addPage('P');
$p->setFont('arial', '', 24);
$p->cell(0, 9, "Invoice", 0, 1, 'C');
$p->setFont('arial', '', 14);
$p->write(6,date("F j, Y"));
$p->newLine();
$p->write(6,"Invoice #DIM-09-10-001");
$p->newLine();
$p->write(6,"Invoice for X");
$p->newLine();
$p->newLine();
$p->setFont('arial', '', 12);
$p->write(10, 'Work performed @ hourly rate of $20.00');
$p->newLine();
$p->newLine();
$widths = array(23,90,15,25);
$header = array("Date","Task","","Time");
foreach($header as $num=>$col)
$p->Cell($widths[$num],7,$col,"B");
$p->newLine();
foreach($data as $row)
{
$i=0;
foreach($row as $name=>$col)
{
$p->Cell($widths[$i],10,$col,0);
$i++;
}
$p->newLine();
}
$table_footer = array(array("","Total Time",'8 hours @ $20/hour'),array("","Total Fees Due",'$160'));
$widths = array(80,35,40);
$borders = array(array(0,"T","T"));
foreach($table_footer as $rownum=>$row)
{
foreach($row as $num=>$col)
$p->Cell($widths[$num],10,$col,$borders[$rownum][$num]);
$p->newLine();
}
$p->write(10,"Please make check payable to ");
$p->setFontStyle("B");
$p->write(10,"David Mihal");
$p->newLine();
$p->newLine();
$p->setFontStyle("I");
$p->write(4,"All invoices are due and payable within 30 days. Thank you for your prompt attention to this invoice and for your continued business.");
$p->close();
$p->output('invoice.pdf',true);
http://net.tutsplus.com/tutorials/other/how-to-generate-pdfs-with-php-new-plus-tutorial/ 9 bucks但是最全面的教程。 – 2011-05-14 18:41:12
http://stackoverflow.com/questions/124959/create-word-document-using-php-in-linux/132054#132054然后,而不是odt - > doc,通过OpenOffice命令运行odt - > pdf转换线路接口 – 2011-05-14 18:45:26