A non-numeric value encountered php 7 tcpdf - php

$header_x = (float)$this->original_lMargin + (float)($headerdata['logo_width'] * (float)1.1);
Severity: Warning
Message: A non-numeric value encountered
Filename: tcpdf/tcpdf.php
Line Number: 3422

I worked on this issue many days. In my case, I solved this problem on this way:
When you create a PDF with tcpdf you need to use ob_start(); at the top, then create instance object :
$pdf = new pdf(PDF_PAGE_ ..... BODY.. FOOTER, ETC,
and before output :
$pdf->Output('/media/Linux/Folder/document.pdf', 'F')
You need to end your ob with:
ob_end_clean();
I realised about the problem from create two or more PDFs continuously. You could try this.
I found the answer while visiting this:
TCPDF ERROR: Some data has already been output, can't send PDF file

Related

Illegal string offset '/Root' in FPDF FPDI Parser issue

I have multiple pdf files of one user. So, I have given an option to our user to see all his document in a single PDF file.
For this, I am using FPDI pdf parser to merge all pdf files in a single file and then show to user. But I am getting below error:
Illegal string offset '/Root' in pdf_parser.php line 90
the function in which this error is thrown is given below:
protected function _readRoot()
{
if ($this->_xref['trailer'][1]['/Root'][0] != self::TYPE_OBJREF) {
throw new \Exception('Wrong Type of Root-Element! Must be an indirect reference');
}
$this->_root = $this->resolveObject($this->_xref['trailer'][1]['/Root']);
}
Can anyone please tell me what kind of issue is this. I have tried a lot as well as googled many things but failed.
Thanks in Advance.

LoadXML file too big

I am trying to load xml content from a URL containing about 60MB of data. When I do that using simple XML built in library I keep getting the following error:
PHP Warning: DOMDocument::loadXML(): internal error: Huge input lookup in Entity, line: 845125
And the script is being stopped. What's wrong? How can I deal with this?
Sample url I use:
http://foo.com/feed.xml

PHPExcel - chart rendering and load excel giving error

require_once('PHPExcel-1.7.7/Classes/PHPExcel.php');
$inputFileName = 'RN Tracker.xlsx';
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
if i try following
$objReader->setIncludeCharts(TRUE);
during load i get following error message:
Warning: PHPExcel_Reader_Excel2007::load(): Node no longer exists in /users/pravkum4/html/tracker/PHPExcel-1.7.7/Classes/PHPExcel/Reader/Excel2007.php on line 1518
Notice: Trying to get property of non-object in /users/pravkum4/html/tracker/PHPExcel-1.7.7/Classes/PHPExcel/Reader/Excel2007.php on line 1519
Fatal error: Call to a member function children() on a non-object in /users/pravkum4/html/tracker/PHPExcel-1.7.7/Classes/PHPExcel/Reader/Excel2007.php on line 1519
What mistake i am doing here?
Should i include some additional class for chart?
Does chart option is included by default in load method of reader? chart count gives 0. :((
Sometimes gives correct chart count but rendering doesn't work.
One more thing, what is this code? not working for me. Sometimes i get jpgraph_pie.php missing.
PHPExcel_Settings::setChartRenderer(
PHPExcel_Settings::CHART_RENDERER_JPGRAPH,
dirname(__FILE__).'/../../libraries/Charts/jpgraph3.5.0b1/src'
);
Please provide a tutorial for chart rendering. Thank you so much in Advance.
I have yet to see this issue raised at the PHPExcel sites on either CodePlex or on Github... and to resolve it you'll need to upload a sample file that demonstrates the problem so that we can identify what node no longer exists in the Excel data
Look at this this may help you...
http://phpexcel.codeplex.com/workitem/16
http://phpexcel.codeplex.com/wikipage?title=Examples

DOM PDF renders on mac but not PC

I'm using DOM PDF to convert a simple html page to a PDF--everything works on mac, but on PC I get the message:
Is there a log I can check? What could make this work on mac (using preview) but not adobe on windows?
Edit
As bfavaretto suggested, I opened the PDF in textedit. Here's the error:
<p>Message: Function set_magic_quotes_runtime() is deprecated</p>
<p>Filename: lib/class.pdf.php</p>
<p>Line Number: 4332</p>
Here is my CI code:
function pdf($id)
{
// Setup fields
$this->load->helper('htm_to_pdf');
$data['data'] = $this->home_model->getReport(array('id'=>$id));
$html = $this->load->view('HTML2PDF/Code/index', $data, true);
pdf_create($html, 'filename');
}
set_magic_quotes_runtime is not used anymore in dompdf 0.6. I suggest you to download the latest version (0.6 beta 3) or to remove the set_magic_quotes_runtime call in lib/class.pdf.php.
It is a warning thrown by PHP because this function is deprecated.
Some wiki usage information
require_once("dompdf_config.inc.php");
$html_to_string = $this->load->view('', array(), true);
$dompdf = new DOMPDF();
$dompdf->load_html($html_to_string);
force_download('sample.pdf', file_get_contents($dompdf->render()));
-
Instead of force download you could use
$dompdf->stream("sample.pdf");
I've seen posts about similar issues (I had a bunch of issues with DOMPDF), it sounds like there is other text in the output stream that's causing specifically Acrobat to reject the PDF as corrupt.
Try adding setlocale(LC_NUMERIC, "C"); before you call DomPDF
Take a look at this thread for more info: http://code.google.com/p/dompdf/issues/detail?id=418

How to insert Image in pdf using PHP (Generating a PDF)?

I want to generate a PDF that will contain an image.
so i already tried this line of codes:
$pdf->Image('b.png',10,8,33);
the other is:
$pdf->Image('Project_ITCPH\images.jpg', 1, 10, 5.8, 1.5);
the problem here is this Error:
"Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\xampp\htdocs\Project_ITCPH\reports\fpdf.php on line 931
FPDF error: Alpha channel not supported: b.png"
is there a problem with the fpdf.php? i only use it as include.
You have my regards.
This error simply means that FPDF is using a function call that is deprecated and outdated. This is shown because your PHP displays errors and warnings and deprecation notes. You should try turning off errors before generating the PDF or writing # before function calls (like here) when using FPDF.
By the way, I highly recommend you use mPDF for PDF generation with PDF, it's better supported in my opinion.
Upgrade your FPDF to 1.7. It now supports alpha channel in PNGs.
Check out this class it lets you add images to PDF's with PHP it has a lot of demo's
https://github.com/dompdf/dompdf
Try
$pdf->Image('..\Project_ITCPH\images.jpg', 1, 10, 5.8, 1.5);
this is some time happen cause server could not find the folder path hope this work for u
also try this
require('fpdf.php');

Categories