dompdf

Laravel dompdf error “Image not found or type unknown”

倾然丶 夕夏残阳落幕 提交于 2020-02-03 08:25:30
问题 I am getting error "Image not found or type unknown" after downloading PDF in Laravel 5.4 using dompdf package. Here is the method public function pdf() { $users = User::get(); $pdf = PDF::loadView('pdf', compact('users')); return $pdf->download('Users.pdf'); } My view file <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>PDF</title> </head> <body> <div class="container"> <div class="row"> @foreach ($users as $user) <img src="public/storage/images/{{ $user->profile_pic }}

Laravel dompdf error “Image not found or type unknown”

柔情痞子 提交于 2020-02-03 08:23:42
问题 I am getting error "Image not found or type unknown" after downloading PDF in Laravel 5.4 using dompdf package. Here is the method public function pdf() { $users = User::get(); $pdf = PDF::loadView('pdf', compact('users')); return $pdf->download('Users.pdf'); } My view file <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>PDF</title> </head> <body> <div class="container"> <div class="row"> @foreach ($users as $user) <img src="public/storage/images/{{ $user->profile_pic }}

How to include the external style sheet in dom pdf

空扰寡人 提交于 2020-01-21 11:24:47
问题 I am using Dompdf for the report generation in the php. I am not able to include the external style sheet for the same... The code I am using is similar to the following: <?php require_once "dompdf/dompdf_config.inc.php"; $dompdf = new DOMPDF(); $html =" <table> <tr > <td class='abc'>testing table</td> </tr> <tr> <td class='def'>Testng header</td> </tr> </table>"; $dompdf->load_html($html); $dompdf->render(); $dompdf->set_base_path('localhost/exampls/style.css'); $dompdf->stream("hello.pdf");

Have dynamic content span across pages in php

眉间皱痕 提交于 2020-01-17 05:07:10
问题 I have the following code that dynamically loads items in an invoice. I am looking for a way to adds excess items to a new page, and so on. I would like to limit the # of items on a page to a set amount, say 15 items. Is there a way to do this in php? The code below is within a document that uses dompdf to appear in pages form foreach ( $invoice['InvoiceDetail'] as $key=>$item){ $html .= '<tr style="border-bottom: 1px solid #ccc; line-height: 15px;">'; $itemNo = isset($item['product_id']) ?

Corrupt PDF on the fly attached to email via dompdf

狂风中的少年 提交于 2020-01-17 04:31:06
问题 I'm trying to attach a PDF on the fly to send it via email, but i'm getting it corrupted when i download it from there. I also tried to put it inside a .zip, but it didn't change the status of the .pdf itself. Here's my code: //email para o cliente $this->load->library('email'); $config['newline'] = "\r\n"; $this->email->from('contato@avanhandava.org', 'Avanhandava'); $this->email->to($this->input->post('email')); $this->email->subject('Inscrição para o Acampô'); $this->email->message($this-

DOMPDF Page background (or alternatives?)

做~自己de王妃 提交于 2020-01-16 18:27:11
问题 I am trying to export some dynamic content into a PDF file with a small bit of page formatting. I'd like to have the PDF pages have a small padding with a border and then inside that border, a small company logo should appear up the top right on each page. Now the issue is that because the content is dynamic, the number of pages and content per page can vary. This means I can't manually create a DIV with a border and an image inside because the content could be more or less pages depending on

open dompdf in new tab taken data from given page

北慕城南 提交于 2020-01-16 05:09:45
问题 I know that there are at least two other similar questions, but they do not help me. I have textarea with tinymce where user writes his text. Then there is a button "PDF" that should create pdf and open it in new tab. The content of pdf is the content in tinymce. When user click on button, the form is submitted to index.php action. Then index.php gathers information from $_POST variable and creates pdf. I cannot get it to open in new tab as a normal link. I tried it in different ways. 1) I

dompdf: templates & $_SESSION variables

≡放荡痞女 提交于 2020-01-14 06:15:31
问题 i was wondering if this setup would work. i have to crank out a batch of PDF from a bunch of variables i'm pushing into the $_SESSION via a form (duh...). the idea is to pass the template file to the dompdf engine and have the template populate from the $_SESSION then out to PDF. it seems to me that when the $template gets loaded it should do that, yes? here's the basic code: <?php function renderToPDF($theTemplate = "template.php") // this is just to show the value { require_once("dompdf

How to create a pdf file from an HTML using php, and then save it on the server

纵然是瞬间 提交于 2020-01-12 03:52:12
问题 I have a project to save pages created dynamically with php and store them on the server. I am planning to store a replica of the page as a pdf; with all their images, tables and the layout. I tried to use these tools: DOMPDF FPDF But I honestly do not think it's going on the right track Have any solutions or could these tools solve this problem? 回答1: From forosdelweb We are going to create a class to make the convertion in convertToPDF.php <?php /*--------------------------------------------

Adding header and footer with page number in dompdf

流过昼夜 提交于 2020-01-10 14:29:07
问题 I am working with Codeigniter and I successfully implemented dompdf for generating PDF files. Now I have issues on adding a header and footer in generated PDF. Here is the my dompdf_helper code: <?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->load_html($html); $dompdf->render(); $dompdf->set_paper("A4"); if ($stream) { $dompdf->stream