File type plain text document (text/plain) is not supported. error in dompdf

2,509 views
Skip to first unread message

Anita Yadav

unread,
Mar 6, 2014, 1:19:30 AM3/6/14
to dom...@googlegroups.com
Hello team,

Plz help me out..:(

I am using dompdf lib files to create dyanamic pdf. But when it downloads and after opening it, gives error Unable to open document.

and also pdf is not empty, content is printing, but not opening properly.

I am using joomla based application with using dompdf library.

Following is the system details
System Information
SettingValue
 
PHP Built OnLinux Anita-PC 3.2.0-55-generic-pae #85-Ubuntu SMP Wed Oct 2 14:03:15 UTC 2013 i686
Database Version5.1.61
Database Collationutf8_general_ci
PHP Version5.3.10-1ubuntu3.9
Web ServerApache/2.2.22 (Ubuntu)
WebServer to PHP Interfaceapache2handler
Joomla! VersionJoomla! 2.5.13 Stable [ Ember ] 24-July-2013 14:00 GMT
Joomla! Platform VersionJoomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT
User AgentMozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
and also attaching the 1 .php file and 1 .pdf file.
Please review and reply soon.
pdf.php
Construction.pdf

BrianS

unread,
Mar 7, 2014, 9:59:15 AM3/7/14
to dom...@googlegroups.com
If you open your PDF in a text editor (Notepad, TextEdit, vi, etc) you will see that some CSS has been captured in the output stream. It wasn't obvious to me when looking briefly at the PHP where this was happening, but I would guess it's happening in a loop somewhere based on the repeating nature of the styling. Here's a sample:

<style>
  body.main-body-style-dark #k2Container .latestItemDateCreated, body.main-body-style-dark #k2Container .latestItemCategory span, body.main-body-style-dark #k2Container .latestItemTagsBlock span, body.main-body-style-dark #k2Container .catItemDateCreated, body.main-body-style-dark #k2Container .catItemAuthor, body.main-body-style-dark #k2Container .catItemCategory span, body.main-body-style-dark #k2Container .catItemTagsBlock span, body.main-body-style-dark #k2Container .tagItemDateCreated, body.main-body-style-dark #k2Container .tagItemCategory span, body.main-body-style-dark #k2Container .userItemDateCreated, body.main-body-style-dark #k2Container .userItemCategory span, body.main-body-style-dark #k2Container .userItemTagsBlock span, body.main-body-style-dark #k2Container .itemDateCreated, body.main-body-style-dark #k2Container .itemAuthor, body.main-body-style-dark #k2Container .itemTextResizerTitle, body.main-body-style-dark #k2Container .itemRatingBlock, body.main-body-style-dark #k2Container .itemRatingBlock span, body.main-body-style-dark #k2Container .itemContentFooter, body.main-body-style-dark #k2Container .itemCategory span, body.main-body-style-dark #k2Container .itemTagsBlock span, body.main-body-style-dark #k2Container .genericItemHeader span, body.main-body-style-dark #k2Container .genericItemCategory span, body.main-body-style-dark #k2Container .latestItemsCategory h2 a, body.main-body-style-dark #k2Container .itemListCategory h2, body.main-body-style-dark #k2Container .itemListSubCategories .subCategory h2, body.main-body-style-dark #k2Container .itemListSubCategories .subCategory h2 a{ color : #000 !important; }
</style>

That's your first problem, and maybe if you fix it the PDF display issues will go away. But I did see a problem with the PDF content having been truncated. This truncation may be related, but it's hard to say until you address that issue.
Reply all
Reply to author
Forward
0 new messages