首页
开发手册
应用中心
工具
用户中心
FoundPHP Creating a PDF File with A Background Image
English
中文简体
English
上一篇
下一篇
FoundPHP When creating contract-type PDFs, we often encounter the problem that text or pictures cannot be customized. We provide a quick solution, which can be realized by adding an array. #### Creating Agreement PDF original contract documents ![](data/files/edit/20/03/19/200319_17394900.png) We will add party A and domain name information to this background contract, and colleagues will add two superimposed photos to achieve the effect: ![](data/files/edit/20/03/19/200319_17421554.jpg) In the picture, we set the parameters such as stroke, shadow, positioning, font, color, etc., and set the coordinates and size of the photo overlay. The code is as follows: ```php photo_page( array( 'pic' =>'bg.png', //background image 'text' =>array( array( 'data'=>'FoundPHP.com', //text content 'x'=>22, //coordinate 'y'=>49, //coordinate 'color'=>'#000000', //text color 'size'=>14, //text size 'border'=>1, //text stroke size 'border-color'=>'#800000', //stroke color // 'background-color'=>'#fff', //text area background color 'style'=>'line-height:24pt;', //custom style 'font'=>'droidsansfallback', //text font ), array( 'data'=>'foundphp.com', //text content 'x'=>72, //coordinate 'y'=>111, //coordinate 'color'=>'#2sdfef', //text color 'size'=>12, //text size 'style'=>'text-decoration:underline;', //custom style 'shadow'=>1, //shadow ) ), //add pictures 'photo' =>array( array( 'adds'=>'logo.png', //photo address 'x'=>160, //coordinate 'y'=>1, //coordinate 'width'=>55, //width 'height'=>15, //high ), array( 'adds'=>'logo1.png', //photo address 'x'=>150, //coordinate 'y'=>40, //coordinate 'width'=>40, //width 'height'=>15, //high 'border'=>1, //Stroke ) ) ) ); //browser printing $pdf->p(); ?> ``` If there are multiple pages, adding photo_page will automatically increase the number of pages, or you can mix html_page usage to increase pages, which can achieve convenient and flexible use.