调用DOMPDF库的render方法时超时

PDF with few pages it works perfectly but when I try to generate a PDF file with more than 20 pages, it presents this error in the browser

ERR_CONECTION_RESET

This is my code to generate pdf:

$html = '
<style>
* { font-family: Tahoma, Verdana, Segoe, sans-serif; color: #333333; font-size: 9px;}

</style>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333">
    <tr>
        <td height="70" bgcolor="#ffffff" colspan="7" align="center" valign="middle"><b style="font-size: 18px;">RELATÓRIO DE FECHAMENTO - Nº '.$id.'</b><br><b>Data do pagamento: '.date('d/m/Y', strtotime($objDados[$idx]->dtpagamento)).'</b></td>
        <td bgcolor="#ffffff" align="center" width="130"><img src="data:image/gif;base64,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" border="0"></td>
    </tr>
    <tr>
        <td height="30" bgcolor="#ffffff" colspan="8" align="center" valign="middle" colspan="2"><b style="font-size: 16px;">DETALHADO</b></td>
    </tr>
    <tr style="color: #ffffff !important;">
        <td bgcolor="#1369a1" width="45" height="20"><b>DATA</b></td>
        <td bgcolor="#1369a1"><b>TIPO</b></td>
        <td bgcolor="#1369a1" width="30"><b>CHAPA</b></td>
        <td bgcolor="#1369a1" width="150"><b>NOME</b></td>
        <td bgcolor="#1369a1"><b>BANCO</b></td>
        <td bgcolor="#1369a1" width="45"><b>AGENCIA</b></td>
        <td bgcolor="#1369a1" width="45"><b>CONTA</b></td>
        <td bgcolor="#1369a1"><b>VALOR em R$</b></td>
    </tr>
    '.$lista_individual.'
</table>

<br>
<br>

<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333">
    <tr>
        <td bgcolor="#ffffff" height="30" colspan="3" align="center"><b style="font-size: 16px;">SUBTOTAL</b></td>
    </tr>
    <tr style="color: #ffffff !important;">
        <td bgcolor="#1369a1" width="45" height="20"><b>CHAPA</b></td>
        <td bgcolor="#1369a1"><b>NOME</b></td>
        <td bgcolor="#1369a1" width="130"><b>SUBTOTAL em R$</b></td>
    </tr>
    '.$lista_subtotal.'
    <tr>
        <td bgcolor="#c8e5f7" colspan="2" align="center" height="20"><b style="font-size: 16px;">TOTAL</b></td>
        <td bgcolor="#c8e5f7" width="130"><b>'.number_format($lista_total,2,',','.').'</b></td>
    </tr>
</table>

<br>
<br>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333">
    <tr>
        <td bgcolor="#1369a1" width="50%" height="20" align="center" style="color: white; font-size: 12px;">TOTAL BANCO SANTANDER - 033</td>
        <td bgcolor="#1369a1" width="50%" align="center" style="color: white; font-size: 12px;">TOTAL OUTROS BANCOS</td>
    </tr>
    <tr>
        <td bgcolor="#ffffff" height="20" align="center" ><b>'.number_format($tot_santander, 2 , ',', '.').'</b></td>
        <td bgcolor="#ffffff" align="center"><b>'.number_format($tot_qualquerbanco, 2 , ',', '.').'</b></td>
    </tr>

</table>

';







$dompdf->load_html(utf8_encode($html));
$dompdf->render();


$dompdf->stream(
    "saida.pdf", 
    array(
        "Attachment" => false
    )
);

Is there a way to optimize time? PDF with few pages works normally but in PDF with many pages DOMPDF returns this error in the browser...

I'm trying to search for a solution all over the internet, but none worked. I tried to increase set_time_limit but it did not work either.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
使用Dompdf库生成的PDF填充tempfolder

<div class="post-text" itemprop="text"> <p>I am currently generating some pdfs with the dompdf library but every time a pdf is being generated my temp folder is being filled with this file and the images associated with it. I am trying to unlink or delete the pdf and any temp files generated with it but the following code is not giving the desired result. Does anyone know what else I can do in this situation? I am using PHP and have installed the library with composer.</p> <p>pdf code:</p> <pre><code> // reference the Dompdf namespace use Dompdf\Dompdf; // instantiate and use the dompdf class $dompdf = new Dompdf(); //$dompdf-&gt;loadHtml('hello world'); $dompdf-&gt;set_option('isHtml5ParserEnabled', true); $dompdf-&gt;set_option('isRemoteEnabled', true); $dompdf -&gt; loadHtml($html); // (Optional) Setup the paper size and orientation $dompdf-&gt;setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf-&gt;render(); // Output the generated PDF to Browser $dompdf-&gt;stream(); unlink($dompdf); </code></pre> </div>

来自Appcontroller的Cakephp-Calling Parent render()函数给出错误:在非对象上调用成员函数send()

<div class="post-text" itemprop="text"> <p>I am trying to build a piece of application using cakephp; which will generate output in multiple formats (xml, json, custom, html).</p> <p>Based on certain property, output format will be decided. What I want is, if html is output ype; then I want application to render view as usual (Regular Controller-&gt;render); else data should be rendered in other formats</p> <p>Here is what I am trying to do. I have overridden function render in AppController.php as following -</p> <pre><code>public function render($view = null, $layout = null) { if ($this-&gt;rType == "json") { $this-&gt;_renderJson(); } else if ($this-&gt;rType == "xml") { $this-&gt;_renderXml(); } else if ($this-&gt;rType == "custom") { $this-&gt;_renderCustom(); } else { parent::render($view,$layout); } } </code></pre> <p>This works perfectly with other formats but html.</p> <p>I want call should be forwarded to Controller::render as normal cakephp flow would do. Instead it gives me below error</p> <p>Error: Call to a member function send() on a non-object File: /xx/lib/Cake/Routing/Dispatcher.php Line: 174</p> <p>Any thoughts - how can I resolve this ?</p> </div>

DOMPDF渲染动态表的解决方案

<div class="post-text" itemprop="text"> <p>I am using DOMPDF to render HTML tables. However, because large tables we'll say greater that 150 rows render extremely slowly. I know this is a known issue for DOMPDF. </p> <p>Does anyone know of any good work around? Maybe using a different html to pdf converter? How to write html code that is formatted like a table without using a table? </p> <p>Any idea?</p> </div>

DOMPDF创建大型PDF时计时

<div class="post-text" itemprop="text"> <p>I'm using DOMPDF with Laravel 5 to generate PDFs from some of my views. It works well on everything except one where it keeps timing out. The code I am using for this view is exactly the same as what I'm using for another which works fine except this one returns more results. I've tried increasing the timeout limit but this didn't help.</p> <p>Just wondering if anyone has any ideas on how to fix this? I found a few results online but they are all quite old and most of them were a bug with nested tables.</p> <pre><code>$TheDate = Request::input('TheDate'); $contractor_results = DB::table('contractors') -&gt;where('CurrentEmployee', '=', 1) -&gt;get(); $employee_results = DB::table('current_employees') -&gt;where('CurrentEmployee', '=', 1) -&gt;get(); $sortResults = array_merge($contractor_results, $employee_results); $sortResults = collect($sortResults); $contractors = $sortResults-&gt;sortBy(function($sortResults){ return sprintf('%-12s%s', $sortResults-&gt;SURNAME, $sortResults-&gt;NAME); }); $Departments = DepartmentCode::where('ShowOnSheet', 1) -&gt;orderBy('Sort', 'ASC') -&gt;get(); $pdf = PDF::loadView('attendance.contractor_sheet', compact('contractors', 'TheDate', 'Departments'))-&gt;setPaper('a4')-&gt;setOrientation('portrait'); return $pdf-&gt;stream('SignonSheet.pdf'); </code></pre> <p>Edited to add code. If I render the view as normal without going to a PDF it works without any issues.</p> <p>Thanks for your help.</p> </div>

Dompdf在本地工作但不在线

<div class="post-text" itemprop="text"> <p>I have problems with dompdf, it works perfectly on localhost, but absolutely not online : </p> <p>The pdf isn't generated but is displayed on the browser : my code : </p> <pre><code>&lt;?php ob_start();?&gt; //My code &lt;?php $html = ob_get_clean(); require_once 'dompdf/autoload.inc.php'; ?&gt; &lt;?php // reference the Dompdf namespace use Dompdf\Dompdf; // instantiate and use the dompdf class $dompdf = new Dompdf(); $dompdf-&gt;loadHtml($html); // (Optional) Setup the paper size and orientation $dompdf-&gt;setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf-&gt;render(); // Output the generated PDF to Browser $dompdf-&gt;stream(); ?&gt; Votre paiement a bien été pris en compte. &lt;?php $output = $dompdf-&gt;output(); file_put_contents("factures/".$nbr.".pdf", $output); ?&gt; </code></pre> </div>

Django ajax无法调用后台方法

![图片说明](https://img-ask.csdn.net/upload/202004/08/1586339472_731380.png) 事件触发后无法调用ans_ajax方法,没有与视图函数连接 (不是因为type:psot这个原因) 视图函数代码如下: ``` def ans_ajax(request): text = request.POST.get('text') pro_id = request.POST.get('pro_id') user_name = request.session.get('user_name', default='') num = models.Ans.objects.count() + 1 models.Ans.objects.create(ans_id=num,ans_content=text,to_pro_id=pro_id,user_name=user_name) return render(request, 'homepage.html') ``` 求大佬帮忙解决

怎样调用这个方法

var t=Ext.extend(Ext.Panel,{ <br /> <br /> aa:function(){ <br /> alert(123); <br /> }, <br /> buttons:[{text:'dsad',handler:function(){ <br /> <br /> //我想调用aa方法 <br /> //aa();这是不行 的 <br /> //this.aa();也不行 <br /> }}] <br /> <br /> <br />}) <br />Ext.onReady(function(){ <br />new t({ <br /> <br />renderTo:Ext.getBody() <br />}); <br />}) <br /> <br />我是初学者,请解答一下。。 <br />谢谢!

如何修复:domPDF生成的输出结果?

<div class="post-text" itemprop="text"> <p>Hi this is what I'm getting with the domPDF. Is my final result, but obviously I don't want that, I want my page printed in PDF.</p> <p>I need the file get downloaded in the user browser, not in localhost.</p> <p><a href="https://i.stack.imgur.com/p7i6N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p7i6N.png" alt="enter image description here"></a></p> <p>This is my javascript:</p> <pre><code>$("#submit").click(function(){ $.post("converter/converter.php", {strHtml: $(".container- fluid").html()}, function(data, status){ alert("Data: " + data); }); }); </code></pre> <p>this is my php:</p> <pre><code>&lt;?php require_once '../dompdf/autoload.inc.php'; use Dompdf\Dompdf; $html = $_POST['strHtml']; $dompdf = new Dompdf(); $dompdf-&gt;loadHtml($html); $dompdf-&gt;setPaper('A4', 'landscape'); $dompdf-&gt;render(); $dompdf-&gt;output('test.pdf', 'F'); ?&gt; </code></pre> <p>This is what I want to display in pdf :</p> <p><a href="https://i.stack.imgur.com/xpJZc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xpJZc.png" alt="enter image description here"></a></p> </div>

ExtJS的renderTo相关问题

[code="java"]<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript"> Ext.onReady(function() { Ext.BLANK_IMAGE_URL = '/ExtDemo/images/s.gif'; var root = new Ext.tree.TreeNode({ id:"root", text:"树的根" }); var c1 = new Ext.tree.TreeNode({ id:"c1", url:"/ExtDemo/demo/table.jsp", //hrefTarget:"_blank", text:"子节点1" }) var c2 = new Ext.tree.TreeNode({ id:"c2", url:"/ExtDemo/demo/tree.jsp", //hrefTarget:"_blank", text:"子节点2" }) root.appendChild(c2); root.appendChild(c1); var tree = new Ext.tree.TreePanel({ [color=red]renderTo:"hello",[/color] root:root, enableDD : true, width:200 }); // tree.on("click",function(node,event) { // Ext.MessageBox.alert("提示","您点击了--"+node.id); // }); tree.on('click', function(node) { //当我点击某个节点的时候会出发这个事件 if (node.attributes.url != null) { //拆分节点的id,判断是否为二级节点 addtab(node.id, node.attributes.url, node.text); //调用上面对应的方法 } }); }); </script> </head> <body> <div id="hello"></div> </body> </html> [/code] 我想问下在上面的代码中renderTo:"hello",这里可以用其他的代码代替吗,我不想指定div,也就是不行用renderTo:"hello",和<div id="hello"></div>而直接显示在页面可以么?

Dompdf unicode字符(仅在服务器上)

<div class="post-text" itemprop="text"> <p>I use dompdf to render my html pages to pdf. I prepared templates in php and used the codes below. It works fine on localhost, but fails (shows question marks instead of unicode chars) when I upload it on the server. And FontAwesome also fails to show icons.</p> <p>generator.php</p> <pre><code>&lt;?php session_start(); ob_start(); //dompdf require_once('../../dompdf/autoload.inc.php'); use Dompdf\Dompdf; require_once('../pdf-template/template.php'); $template=ob_get_clean(); $dompdf=new Dompdf(); $dompdf-&gt;loadHtml($template); //paper $dompdf-&gt;setPaper('A4','portrait'); // render $dompdf-&gt;render(); $pdf_content = $dompdf-&gt;output(); file_put_contents('test.pdf',$pdf_content); echo "successful"; ?&gt; </code></pre> <p>template.php</p> <pre><code>&lt;i class="fa fa-paw"&gt;&lt;/i&gt; &lt;h2 style="font-family: DejaVu Sans; font-size: 22px"&gt;ığĞüÜşŞİöÖçÇ&lt;/h2&gt; </code></pre> </div>

使用DomPDF创建日志文件

<div class="post-text" itemprop="text"> <p>I'm having a problem getting font-awesome to work inside of a DomPDF document on my webserver. However, the same HTML does work when using eclecticgeek.com's DomPDF debug helper. Therefore, I know there is not problem with the HTML. Here's a link to the working code:</p> <p><a href="http://eclecticgeek.com/dompdf/debug.php?identifier=d0c3b30ed7fd65fabb5c64dda47decc5" rel="nofollow noreferrer">http://eclecticgeek.com/dompdf/debug.php?identifier=d0c3b30ed7fd65fabb5c64dda47decc5</a></p> <p>I am trying to populate DomPDF's log file on my local webserver to help isolate the issue, but no file is generating for me. Here's my full code, I am trying to set the log file via DomPDF's options, but am not sure I am doing it right. </p> <pre><code>&lt;?php require_once "sites/all/libraries/dompdf/autoload.inc.php"; use Dompdf\Dompdf; $HTML = &lt;&lt;&lt;HTML &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"&gt; &lt;link href="https://fonts.googleapis.com/css?family=Macondo" rel="stylesheet"&gt; &lt;style type="text/css"&gt; .fa { display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 1; font-family: FontAwesome; font-size: inherit; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;&lt;span class="fa fa-envelope"&gt;&lt;/span&gt; Font awesome doesn't work on my webserver&lt;/p&gt; &lt;p style='font-family: "FontAwesome"'&gt; &amp;#xf2b9; &lt;/p&gt; &lt;span&gt; this also does not work &lt;/span&gt; &lt;p style='font-family: "Macondo", cursive;'&gt; This font works&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; HTML; $dompdf = new \Dompdf\Dompdf(array( 'tempDir' =&gt; 'sites/test.com/modules/CCPDF/', 'isRemoteEnabled' =&gt; true, 'isPhpEnabled' =&gt; true, 'isJavascriptEnabled' =&gt; true, 'pdfBackend' =&gt; "CPDF", 'isHtml5ParserEnabled' =&gt; true, 'logOutputFile' =&gt; 'sites/test.com/modules/CCPDF/test.log', 'DOMPDF_UNICODE_ENABLED' =&gt; true )); $dompdf-&gt;load_html($HTML); $dompdf-&gt;setPaper('A4', 'portrait'); $dompdf-&gt;render(); $dompdf-&gt;stream(); ?&gt; </code></pre> <p>Can anybody provide an example of how to properly set the DomPDF log file?</p> </div>

Dompdf下载要求保存Adobe Reader

<div class="post-text" itemprop="text"> <p>I'm making a download of PDF with DOMPDF. Everything is working fine. The PDF is downloading and opens well in Adobe Reader. But at closing the window, Adobe Reader is asking me if I want to save the PDF file where I didn't change anything in. What is the possible problem that cause this problem? </p> <pre><code>$filename = $naam.' Factsheet.pdf'; $dompdf = new DOMPDF(); $dompdf-&gt;load_html($html); $dompdf-&gt;render(); file_put_contents('pdf/'.$filename, $dompdf-&gt;output( array("compress" =&gt; 0) )); if ( !headers_sent() ) { $dompdf-&gt;stream($filename, $options); } </code></pre> <p>Can please anybody help me with this problem?</p> </div>

DOMPDF错误:类Dompdf \ FrameDecorator \ AbstractFrameDecorator没有资金

<div class="post-text" itemprop="text"> <p>I'm getting this error:<br> <b>Fatal error</b>: Class 'Dompdf\FrameDecorator\AbstractFrameDecorator' not found in <b>/public_html/vendor/dompdf/dompdf/src/FrameDecorator/Page.php</b> on line <b>23</b><br> Locally works just fine, but on live server is trowing that error<br><br></p> <pre><code>$dompdf = new Dompdf(); $dd = (OBJECT)array( 'ss'=&gt;$data-&gt;ss, 'cr'=&gt;date('Y-m-d'), 'c_n'=&gt;$data-&gt;c_n ); $path = PHCERT .'/'; $dompdf-&gt;set_option('defaultFont', 'Courier'); $view = $this-&gt;view()-&gt;make('pdf.cert', compact('dd'))-&gt;render(); $dompdf-&gt;loadHtml($view); $dompdf-&gt;setPaper('A4', 'landscape'); $dompdf-&gt;render(); $oupdf = $dompdf-&gt;output(); $f_name = $data-&gt;names.'_'.time().'_'.$data-&gt;radn.'.pdf'; if(!file_put_contents($path . $f_name, $oupdf)) { $res['file_path'] = 'fail'; } </code></pre> <p>I the php error log doesn't say much but the same error, the apache error log doesn't say anything about it... so, I have no idea what that error only happen on live server...<br> php version on live server is 5.6.30<br> php version on local server is 5.6.25<br><br> I'm using the most recent version of dompdf, as well my other libs. I'm using composer to update my libs... I have no idea whats the problem...</p> </div>

dompdf在codeigniter中生成损坏的pdf

<div class="post-text" itemprop="text"> <p>I am using dompdf for generating pdf in codeigniter application, When I am opening pdf its giving error</p> <p><a href="https://i.stack.imgur.com/wOkPk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wOkPk.jpg" alt="enter image description here"></a>"</p> <p>I checked all stackoverflow stuffs for this,</p> <ul> <li><a href="https://stackoverflow.com/questions/32875865/corrupt-pdf-on-the-fly-attached-to-email-via-dompdf">Corrupt PDF on the fly attached to email via dompdf</a></li> <li><a href="https://stackoverflow.com/questions/20676160/cannot-open-pdf-file-generated-using-dompdf">cannot open pdf file generated using dompdf</a></li> <li><a href="https://stackoverflow.com/questions/5035112/generating-a-pdf-using-codeigniter">Generating a PDF using CodeIgniter</a></li> </ul> <p>and more,but no luck, my code is :</p> <pre><code>$html = file_get_contents(base_url() . "sampleHTMLfilepath"); require_once("dompdf/dompdf_config.inc.php"); if (is_null($this-&gt;_dompdf)) { $this-&gt;_dompdf = new DOMPDF(); } $this-&gt;_dompdf-&gt;load_html($html); $this-&gt;_dompdf-&gt;render(); $this-&gt;_dompdf-&gt;stream('test.pdf); </code></pre> <p>sample html is simple file with p tag </p> <pre><code>&lt;p&gt;Hello &lt;/p&gt; </code></pre> <p>Please help me, Thanks </p> </div>

在dompdf中,相对于“setBasePath”函数是什么?

<div class="post-text" itemprop="text"> <p>I am rendering some html pages in <a href="https://github.com/dompdf/dompdf" rel="nofollow">dompdf</a>. But It doesn't seem to be able to include my images or external css files. If I simply print the page to the screen everything works fine. But dompdf can't find them.</p> <p>I found a function called: <code>setBasePath</code> where the documentation states "Sets the base path used for external stylesheets and images." Sound like what I want but what is this base path relative too? I tried entering relative to root but it still doesn't find anything.</p> <pre><code>$dompdf = new Dompdf(); $dompdf-&gt;loadHtml($template); $dompdf-&gt;setBasePath(realpath('./')); $dompdf-&gt;render(); $dompdf-&gt;stream('note'); </code></pre> </div>

dompdf图像不起作用

<div class="post-text" itemprop="text"> <p>The images do not appear loop. Only the first image appears the rest does not.</p> <pre><code>$namePic = ""; foreach($_POST['ck'] as $ck){ $namePic.= $ck.", "; $namesPic = explode(",", $namePic); } $dompdf = new DOMPDF(); $html = ""; for($i = 0; $i &lt; $count; $i ++){ $html.= "&lt;html&gt;&lt;head&gt;&lt;style type='text/css'&gt; &lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;div style=\"page-break-after: always;\"&gt;&lt;p align=\"center\"&gt;&lt;img src=\"../folder/images/$namePic[$i]\" &gt;&lt;/p&gt;&lt;/div&gt;"; } $html.= "&lt;/body&gt;&lt;/html&gt;"; $dompdf-&gt;load_html($html); $dompdf-&gt;set_paper("a4", "portrail"); $dompdf-&gt;render(); $pdf = $dompdf-&gt;output(); $folder = "../sample.pdf"; file_put_contents($folder,$pdf); </code></pre> <p>With this I can generate the pdf, but it does not show all the images of the loop shows only the first image. How can I do to show all the images in my loop?</p> </div>

忽略背景颜色 - DOMPDF

<div class="post-text" itemprop="text"> <p>I am generating PDFs using DOMPDF. Everything works fine. However, when I open the pdf file I can see the default grey background color. I had some other tables to print but it had the same issue, I thought may be something is wrong with my CSS. I tried to change the background color of all <code>divs</code> and <code>tables</code> but nothing worked. Therefore, I decided to print only dummy data with no css to see if there is any other issue. When i tried to print the only one word then below is the result i can see in PDF.</p> <p><img src="https://i.stack.imgur.com/QvHou.jpg" alt="enter image description here"></p> <p>So, I am wondering how can i change it in to white color. </p> <p>Following is my simple 5 lines code to generate this.</p> <pre><code> $dompdf = new DOMPDF(); $dompdf-&gt;load_html($listing); $dompdf-&gt;set_paper('a4', 'landscape'); $dompdf-&gt;render(); file_put_contents('file.pdf', $dompdf-&gt;output()); </code></pre> </div>

使用dompdf和codeigniter的问题

<div class="post-text" itemprop="text"> <p>I have started experimenting with codeigniter and pdfs. I'm using the latest version of both. For some reason, i'm getting this error when trying to render the pdfs:</p> <pre><code>Warning: require_once(C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf/include/ci_exceptions.cls.php) [function.require-once]: failed to open stream: No such file or directory in C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf\dompdf_config.inc.php on line 208 Fatal error: require_once() [function.require]: Failed opening required 'C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf/include/ci_exceptions.cls.php' (include_path='.;C:\php\pear') in C:\Users\Manfred\Dropbox\Web\Alodu\application\helpers\dompdf\dompdf_config.inc.php on line 208 </code></pre> <p>Code used is: </p> <pre><code>function pdf() { $this-&gt;load-&gt;helper(array('dompdf', 'file')); // page info here, db calls, etc. /* $data=array( "$title"=&gt;"Hello!", "$test_questions"=&gt;"1,2,3,4", ); */ $data['test_questions']= "hello"; $html = $this-&gt;load-&gt;view('pdf/test_ibdp', $data, true); $filename="Test".$data['test_questions']; pdf_create($html, $filename); write_file('name', $data); } </code></pre> <p>And the helper: </p> <pre><code>&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function pdf_create($html, $filename, $stream=TRUE) { require_once("dompdf/dompdf_config.inc.php"); $dompdf = new DOMPDF(); $dompdf-&gt;load_html($html); $dompdf-&gt;set_paper("a4", "portrait" ); $dompdf-&gt;render(); $dompdf-&gt;stream($filename . ".pdf"); } ?&gt; </code></pre> <p>and the view (pure HTML)</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Hello!&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;HelloAgain&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Any suggestions? I'm not that experienced in PHP and i'm quite confused. I just re-downloaded the library, i've tried keeping it really simple by stripping away extras in my code. Nothing seems to work. any help would be great :)</p> </div>

为什么要包含一个数据数组,从控制器调用render()?

<div class="post-text" itemprop="text"> <p>I'm trying to understand how Yii passes data from page to page. One thing that confused me was that the view pages associated with their respective controller could access the data sent to it through render without a post or get request. I.e. </p> <pre><code>//in the controller php file $this-&gt;render('view',array('data1'=&gt;$data1))) //in the view php file if (isset($data1)) { //do something amazing } </code></pre> <p>Now I realize it's because the view will have access to the members of the controller. But then, if that's the case, why would anyone bother putting a data array in the render function?</p> <p>Consider another example provided on SO <a href="https://stackoverflow.com/a/9559619/1406888">here</a>.</p> <p>What am I misunderstanding?</p> </div>

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue + Spring Boot 项目实战(十九):Web 项目优化解决方案

快来一起探索如何打脸我们的破项目,兄弟姐妹们把害怕打在公屏上!

你连存活到JDK8中著名的Bug都不知道,我怎么敢给你加薪

CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

一个HashMap跟面试官扯了半个小时

一个HashMap能跟面试官扯上半个小时 关注 安琪拉的博客 1.回复面试领取面试资料 2.回复书籍领取技术电子书 3.回复交流领取技术电子书 前言 HashMap应该算是Java后端工程师面试的必问题,因为其中的知识点太多,很适合用来考察面试者的Java基础。 开场 面试官: 你先自我介绍一下吧! 安琪拉: 我是安琪拉,草丛三婊之一,最强中单(钟馗不服)!哦,不对,串场了,我是**,目...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

程序员是做全栈工程师好?还是专注一个领域好?

昨天,有位大一的同学私信我,说他要做全栈工程师。 我一听,这不害了孩子么,必须制止啊。 谁知,讲到最后,更确定了他做全栈程序员的梦想。 但凡做全栈工程师的,要么很惨,要么很牛! 但凡很牛的,绝不是一开始就是做全栈的! 全栈工程师听起来好听,但绝没有你想象的那么简单。 今天听我来给你唠,记得帮我点赞哦。 一、全栈工程师的职责 如果你学习编程的目的只是玩玩,那随意,想怎么学怎么学。...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

十个摸鱼,哦,不对,是炫酷(可以玩一整天)的网站!!!

文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

工作两年简历写成这样,谁要你呀!

作者:小傅哥 博客:https://bugstack.cn 沉淀、分享、成长,让自己和他人都能有所收获! 一、前言 最近有伙伴问小傅哥,我的简历怎么投递了都没有反应,心里慌的很呀。 工作两年了目前的公司没有什么大项目,整天的维护别人的代码,有坑也不让重构,都烦死了。荒废我一身技能无处施展,投递的简历也没人看。我是不动物园里的猩猩,狒狒了! 我要加班,我要996,我要疯狂编码,求给我个机会… ...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问