Forum Bugs

There was a error opening this document

mis
Hi @ all

I have a problem with 3 different websites (cms systems), where i render php-Sites into pdfs.

The problem is that I get the following error-message in version 7.0 of Acrobat Reader: There was a error opening this document. The file is damaged and could not be repaired.

You can have a Look at the pdf here: http://goo.gl/bz99f

It will display fine in the Chrome pdf-Sandbox or a newer version of Acrobat Reader.

But in version 7.0 (or lower) you will get this message.


In the example above, prince xml renders this site: http://goo.gl/ntxzN

And there is no error in the log file:

Thu Mar 10 14:41:11 2011: ---- begin
Thu Mar 10 14:41:12 2011: Loading document...
Thu Mar 10 14:41:12 2011: Converting document...
Thu Mar 10 14:41:12 2011: finished: success
Thu Mar 10 14:41:12 2011: ---- end

These 3 sites, are on 3 different servers, so I think, it shouldn’t be a configuration fault or something.

Thanks for your help and greetings from Switzerland :D
jim_albright
I googled:

version 7.0 of Acrobat Reader: There was a error opening this document. The file is damaged and could not be repaired.

found this as possible help:
http://kb2.adobe.com/cps/328/328233.html

Jim Albright
Wycliffe Bible Translators

mikeday
The problem is that the HTML is being appended to the PDF. Once your PHP has called Prince to generate the PDF, it must not generate any further HTML to send to the browser.
mis
Thanks guys!

I found two problems:

1) As mikeday wrote, the script was sending additional html to the browser. The PHP-Script needs to exit/stop, after Prince has generated the PDF.

2) As Adobe writes (Link from jim_albright), the http-header need to be “application/pdf”.

Now everything works fine :-) Thanks for your help!
heheshdee
Hello all,
i have some problem,
i use Prince
my problem is There was a error opening this document.
i'm using adobe acrobat reader x on windows xp.

Prince log is here.
Wed Oct 12 15:22:25 2011: ---- begin
Wed Oct 12 15:22:25 2011: Loading document...
Wed Oct 12 15:22:25 2011: Converting document...
Wed Oct 12 15:22:25 2011: finished: success
Wed Oct 12 15:22:25 2011: ---- end


MY TEMPLATE - test1.pdf.erb
--------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<STYLE>
body{
font-family: Arial,sans-serif;
}
table.gray{
background: #000;
}
table.gray tr td,table.gray tr th{
background: #fff;
}
</STYLE>
</head>
<body style="font-size: 11px;">

<table style="width: 100%">
<tr>
<td width="22%">
Хэрэглэгчийн Овог
</td>
</tr>
</table><br/>
</body>
</html>

------------------ CONTROLLER -------------------
def agl_print
respond_to do |format|
format.html
format.pdf do
render :pdf => "test1",
:stylesheets => ["prince"],
:layout => false,
:template => "customer/test1.pdf.erb"
end
end
end


what is wrong help me plz

best regards,
mikeday
Are you using a Prince plugin for Rails? Which one?