error creating PDF

You are using DaDaBIK version 10.3-Manarola enterprise, installed on 11-13-2020

PHP Version: 7.4.11

mysql version: 8.0.22

Web server: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.4.11

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

URL installation: http://localhost/dadabik/

===============================================

I have recently upgraded from 10.3 Pro to 10.3 Enterprise.

I am attempting to create a PDF from my data, using the default PDF template, and I have no others. I receive this error (from datagrid or details):

Warning: chr() expects parameter 1 to be int, string given in C:\xampp\htdocs\firearms\include\tcpdf\include\tcpdf_fonts.php on line 1671
TCPDF ERROR: Some data has already been output, can't send PDF file


In C:\xampp\htdocs\firearms\templates there are .html files for header and footer only.

1) There is NOT an .html file for the 'body'. Is this expected?

2) What am I doing wrong?
 
In the support forum thread Re: install errors 10.3-Manarola pro ( https://dadabik.com/forum/read.php?1,23069,23107#msg-23107 ) I made the changes that you recommended to C:\xampp\htdocs\firearms\include\db_functions_pdo.php

Try to change these lines

$fks[$row['column_name']]['referenced_table_name'] = $row['referenced_table_name'];
$fks[$row['column_name']]['referenced_field_name'] = $row['referenced_column_name'];

to

$fks[$row['COLUMN_NAME']]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME'];
$fks[$row['COLUMN_NAME']]['referenced_field_name'] = $row['REFERENCED_COLUMN_NAME'];


And in C:\xampp\php\php.ini I have increased max_execution_time= from 60 to 1200.

This is my config_custom.php (certain details redacted)

// add your config parameters here

$serial_number = 'XXXXXXXX';
$dbms_type = 'mysql';
//$host = 'localhost';
$host = 'vanadium.periodic-tbl.com';
$db_name = 'firearms';
$user = 'ufirearms';
$pass = 'XXXXXXXX';
$timezone = 'America/New_York';

if ( (double)phpversion() >= 5.1){
date_default_timezone_set($timezone);
}

$secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$dadabik_session_name = 'dadabikfirearmsconnec';
//$logo_img = 'images/logo.png';
$logo_img = 'images/galaxy.png';
//$title_application = 'DaDaBIK database front-end - dadabik.com';
$title_application = 'Firearms Inventory';
//$enable_data_tab_operations = 0;
$enable_data_tab_operations = 1;
//$debug_mode = 0;
$debug_mode = 1;
$records_per_page_ar[0] = 10;
$records_per_page_ar[1] = 20;
$records_per_page_ar[2] = 50;
$records_per_page_ar[3] = 100;
$records_per_page_ar[4] = 999;
//$word_wrap_col = '25';
$word_wrap_col = '128';
 

eugenio

Administrator
Staff member
Ok, I think we have a small compatibility issue between php 7.4 and TCPDF, I'll update you with a possible workaround soon.

Best,
 
Eugenio,

There's no hurry on this.

I've just managed to screw up my entire entire environment. I was attempting to create a test environment with mysql database dumps and restores and somehow I've got my whole environment (mysql and dadabik) messed up.

Naturally, being a former DBA I have complete and extensive backups: NOT <wry grin>.

I'll post in this thread again when (if) I get back to a position so that I can test whatever workaround you come up with.

In the mean time, if I were you, I wouldn't put too much effort into this issue.

Thanks for your help.

KenC
 

NickR

New member
System info
PHP Version: 7.3.24

mysql version: 10.3.22-MariaDB-cll-lve

Web server: Apache

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

----

I upgraded recently as well to Enterprise and getting similar error whenever choosing pdf so request like this when clicking the pdf button
../index.php?tablename=tblRefreshment&function=search&export_to_pdf=1

and this comes back

TCPDF ERROR: Some data has already been output, can't send PDF file

Happens every way I try to get a PDF so on very simple table with all permissions as YES.
No difference if I choose the default or not and I have not tried to create a template

Only modified the various custom php and custom css files and no other files

I notice that there is no html around the error page the source is simply

<strong>TCPDF ERROR: </strong>Some data has already been output, can't send PDF file

I think it may have worked when first installed
 

eugenio

Administrator
Staff member
The issue with php 7.4 has been fixed with the new dadabik 10.4.

@NickR: are you getting exactly the same error or another one?
 

NickR

New member
I should have updated. I raised this as a support ticket which resolved the problem.

In my case I had a function I created in custom_formatting_functions.php

I had used </br> by mistake as part of the function when I wanted a line break in a cell which in modern browsers was parsed fine as a line break. It should be <br> or <br />.

The TCPDF processes all of the functions in the custom_formatting_functions.php even if it is not using them and this caused the error. It was difficult to trap as I was not using that function on the page I wanted to make pdf from. Had to do a clean install in a different directory, check it worked and add back in all the custom pages until it errored and then found the error and simply changed </br> for <br> and all was ok.
 

eugenio

Administrator
Staff member
Hello,
I don't think this was the problem: if the function is used (e.g. a formatting function) then yes, </br> can be problematic for TCPDF, otherwise if TCPDF doesn't use that function, I would say it's impossible.

Best,
 

NickR

New member
Eugenio

Checked again and as you say it does not error if I create a new unused function with bad html format into custom_formatting_functions.php on the working site.

An odd error I got in checking this is I am use WinSCP as a simple FTP and editor. If I edit the php page directly from the remote website eg right click and open , then even adding a space in a comment and saving that throws the error when dadabik tries to create a pdf. No problems with formatting for the rest of the website.

If I do the same eg add a space to a comment line on my local copy which seems to use the same editor and then upload that then no error and pdf created fine.

There is a difference in the editors I assume (I just use the standard setup) or how the files are opened as more lines and spacing on the remote copy when I open it than the local.

This may have been part of my problem. All works fine now with good formatting and not working on remote files in the WinScp editor since the support help (tu)
.
 

eugenio

Administrator
Staff member
I am glad it works now, it's difficult to say which was the real reason, but consider that any blank line outside the <?php ?> tags will cause TCPDF to fail.

Best,
 
Top