Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » PDF Issues
PDF Issues [message #976] Wed, 25 July 2007 04:58 Go to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
Dear AJM,

I have problem in generating PDF files. We have a lot of rows in database. Some scripts generate PDF quite smoothly and sometimes I encounter the problem of - "The file is damaged and could not be repaired". This is a major issue for my PDF report and please help me to solve this problem ASAP as I am stuck with this problem for a long time and I don't have any clue to resolve this. If you need to ask any question regarding PDF error, please mail me : mazid@mislbd.com

M.H.Chowdhury
Re: PDF Issues [message #977 is a reply to message #976] Wed, 25 July 2007 05:16 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
You should be wary of producing PDF output from large volumes of data as the PDF document is constructed entirely in memory, so it is possible that it is caused by memory issues. If you do not encunter problems with smaller volumes of data then this could be your problem.

The PDF library I use is http://www.fpdf.org/


Re: PDF Issues [message #978 is a reply to message #976] Wed, 25 July 2007 05:49 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
Actually this is a confusing situation. I have PDF for huge volume of data as well as volume of data. Some scripts generate the huge volume of data on the instant and with no error. But I encountered problem while generating data with even 4 records whereas 1500 records of data is generated smoothly. I constantly tried to trace the root of error but data seemed to be passed accurately. At the point of where '$pdf->output()' is called, after that the data gets messed up and output gets corrupted. So please give me some advice on where should I look for errors.
Re: PDF Issues [message #979 is a reply to message #978] Wed, 25 July 2007 06:04 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Have you tried saving the PDF output to disk before sending it to the web browser? If the disk file can be read OK but the browser has problems then it would sound like a browser issue, or perhaps a connection issue.

Re: PDF Issues [message #980 is a reply to message #976] Wed, 25 July 2007 06:09 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
It is not the case that you have stated. I tried generating PDF both in Firefox and IE. Firefox opens the PDF in the same windows and IE need to first save the PDF. PDF with error is encountered for both the browsers and when the PDF is good then both browser acts good.
Re: PDF Issues [message #981 is a reply to message #980] Wed, 25 July 2007 06:35 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
I have tried some PDF generation in both IE6 and IE7, and if 'destination' is set to 'I' (inline) it does not require that the PDF be saved to disk before it is displayed.

Does this error occur with the same data, or is it totally random?


Re: PDF Issues [message #982 is a reply to message #976] Wed, 25 July 2007 06:44 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
The error is totally random. As I have said earlier, for example PDF with 4 records gets damaged whereas other PDF with 1500 records generates nicely. I have checked for Screen file error or the controller file error. But everything seems normal.
Re: PDF Issues [message #983 is a reply to message #982] Wed, 25 July 2007 06:58 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
When you get the error with 4 records, does it always fail with the same 4 records? Or does it sometimes fail and sometimes work?
If it always fails with the same data, then it could be a data problem. What character sets are you using in your database? What fonts are you using in the PDF output?


Re: PDF Issues [message #985 is a reply to message #976] Wed, 25 July 2007 08:13 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
Actually, I forgot to tell you that, when I select records by checking a check box, it generates nicely also sometimes selecting (serially or randomly) more than 5 records (total record more than five) generates an error. It should be normal that if I don't select any record, then all the available records would be generated in PDF. But sometimes some pdf scripts requires to select check boxes and not more than 5 or 6 or some number. On the other hand, huge volume of random records are generated normally.

Anyway, Database type is : MyISAM (CHARSET=UTF8, COLLATE=utf8_unicode_ci).
PDF Font: Arial & Times

Thanks for your quick replies.
Re: PDF Issues [message #986 is a reply to message #985] Wed, 25 July 2007 08:51 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
You are still not answering my question adequately. Do you always get an error with the same selection of records? Does the same selection sometimes work and sometimes not work?

If the same selection of records always fails, and a different selection never fails, then it would indicate that there is something peculiar about that particular selection of records, either in the data itself or the processing of that data in your code.


Re: PDF Issues [message #994 is a reply to message #976] Thu, 26 July 2007 00:56 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
You are still not answering my question adequately. Do you always get an error with the same selection of records? Does the same selection sometimes work and sometimes not work?

If the same selection of records always fails, and a different selection never fails, then it would indicate that there is something peculiar about that particular selection of records, either in the data itself or the processing of that data in your code.

-------------------------

As I told you before, the errors are totally random.
Sometimes we get smooth result without any problem but sometimes the same PDF script does not work.
I can give you a scenario, In a list or 10 records, I don't select any record and try to generate PDF but it is damaged. When I select 1 - 5 subsequent records then all is fine with PDF. Again I select 5 records randomly and get smooth PDF. When I select more than five (whether randomly or consequently) it generates 'damaged' problem. On the other hand huge records have no problem in generating PDF (regardless of selection or non-selection). I have more than 50 PDF scripts and mostly of them are having these sort of problems.
The problems are mostly in the inline PDF generation. But sometimes we get errors when saving PDF into the disk.
If it is a browser issue then it must be a consistent problem regardless of PDF scripts. But some PDF generates fine sometimes and gets corrupted other times.
Re: PDF Issues [message #995 is a reply to message #994] Thu, 26 July 2007 04:55 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
I cannot reproduce this problem in my test environment, so it is impossible for me to come up with a solution. Can you please send me a test set so that I an see what is happening for myself.

What I need is as follows:
- an sql script to create the database and load test data
- a copy of your PHP scripts
- a copy of your <subsystem>.menu_export.sql file so that I can have your subsystem appear in my menus.


Re: PDF Issues [message #1008 is a reply to message #976] Sun, 29 July 2007 01:44 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
We are preparing the package that you require to run the test. You will shortly receive a private email message containing the test package. Thank you.
Re: PDF Issues [message #1011 is a reply to message #976] Mon, 30 July 2007 06:17 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
We are running our software in both Windows and Linux systems. We find that some PDFs that give damaged error in Linux system generates smoothly in windows system (regardless of browser). If PDF damaged issue is somehow related to OS then please give us some solutions.
Re: PDF Issues [message #1012 is a reply to message #1011] Mon, 30 July 2007 08:56 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
I can offer no explanation as to why some PDFs fail in Linux but not in Windows. I use the PDF library from http://www.fpdf.org/ which uses standard PHP code and no special extensions or OS functions. It should produce the same results wherever it is run.

Is it the case that just SOME of the failed PDF files work in Windows, or is it that ALL of them work OK?

What version of Adobe PDF reader do you have installed?

What happens if you save the PDF file to disk instead of opening it in the bowser? Can you view the disk file, or is it still corrupted?

Do you have zlib compression turned ON or OFF in your web server? If you have compression turned ON can you try turning it OFF and testing those PF documents again?


Re: PDF Issues [message #1014 is a reply to message #976] Tue, 31 July 2007 02:23 Go to previous messageGo to next message
mhchy is currently offline  mhchy
Messages: 9
Registered: July 2007
Location: Dhaka
Junior Member
Actually, our global server is Linux based and we use php/mysql distribution package to develop it in windows. We use the same software in our Windows development environment and the linux server. At the time of development, we can generate some PDF files smoothly. But when we apply the same files into the software installed in the Linux server, then some OK PDFs generates damage problem.

I think PDF Reader is not a problem. We are using Adobe Acrobat 6.0 Professional.

Previously we had some problems with Inline and Download operation for PDFs. But now we get the erroneous result for both Inline and Download operations (browser and disk PDFs).

We have zlib compression turned OFF. So no need to concern Zlib compression.

We have some scripts also that works fine when we generate PDF in the disk (IE). But in Inline (Firefox) it gets damaged. I also changed the directive
'destination' => 'I'

to
'destination' => 'D'
. After that when we generate PDF then Firefox returns a file with the extension '.php' and we can rename it to .pdf. But this is not a normal process. So can we save PDFs directly to disk using Firefox?

We are stuck to this error - DAMAGED PDF & CANNOT BE REPAIRED. Please help us to resolve this.
Re: PDF Issues [message #1015 is a reply to message #1014] Tue, 31 July 2007 05:42 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
When I use the instruction
'destination' => 'D'
the generated filename is the script name with '.php' automatically changed to '.pdf', and this works in both IE and Firefox.

If the PDF documents are generated OK from a Windows server but not OK from a Linux server then there must be something on the Linux server which is causing a corruption. It cannot be anything wrong with the code supplied by me otherwise it would not work on ANY server.

The message "PDF IS DAMAGED AND CANNOT BE REPAIRED" does not give me any clues as to what is wrong so I do not have any idea where to look to apply a fix.

If you have the same data on the Windows and Linx servers I can only suggest that you create a PDF that works on the Windows machine, a PDF that does not work on the Linux machine, and save both files to disk so that you can run a 'diff' to highlight any differences between the two files.

You may be using Adobe Acrobat 6.0 Professional, but what version of the free Adobe reader are you using? The latest version is 8. Do you have the latest Adobe plug-in installed in your browser?


Re: PDF Issues [message #1080 is a reply to message #1015] Mon, 03 September 2007 04:56 Go to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Upon investigation this problem only appears to arise when there is too much text in a cell which causes it to attempt to overflow onto the next line. I know that I found and fixed a small problem in this area a few releases ago, so it does not help that you are still using an older version (1.19.0) which does not contain this fix.

In the latest release (1.28.0) I have switched the PDF library from FPDF to TCPDF, and I understand that this has fixed your problem. Is this correct?


Previous Topic: Is the java version of Radicore still alive ?
Next Topic: PDF not readable on early Acrobat Reader
Goto Forum:
  


Current Time: Thu Mar 28 12:43:10 EDT 2024

Total time taken to generate the page: 0.03815 seconds