This is a migrated thread and some comments may be shown as answers.

[Solved] Error while exporting radgrid data to pdf

16 Answers 359 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 23 Mar 2009, 05:55 PM
Hi,

I am exporting the grid data to pdf on a button click.
After clicking on button I will get a window to open / save the pdf file, when I save and open the file I am getting the data in pdf file.
But when I click directly on open button I am getting following error:

There was error in opening this document. This file can not be opened.


Can any one help in this.


Thanks,

16 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Mar 2009, 06:06 PM
Hello Ram,

Please share your RadGrid declaration with us. We will try to provide an appropriate answer for you afterward.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Ram
Top achievements
Rank 1
answered on 25 Mar 2009, 07:29 AM
Hi, I am using the following code.
I tested the application with this code on some other machines it works fine but on some machines it throws error which I described in my previous post ( File corrupts).
What might be the reason for this


 

protected void btnExportToPdf_Click(object sender, EventArgs e)

 

{

isPdfExport =

true;

 

dgDocReport.ExportSettings.ExportOnlyData =

false;

 

 

dgDocReport.ExportSettings.Pdf.PageWidth = 2000;

 

dgDocReport.MasterTableView.ExportToPdf();

 

}

and my source is as follws

 

 

<ExportSettings OpenInNewWindow="True" IgnorePaging="True">

 

 

 

 

<Pdf Author="Anonymous" Title="RadGrid export" Subject="RadGrid Export" Keywords="None"

 

 

 

 

AllowCopy="True" AllowModify="True" PageTopMargin="1in" PageBottomMargin="1in"

 

 

 

 

PageLeftMargin="0.2in" PageRightMargin="0.2in"></Pdf>

 

 

 

 

</ExportSettings>

 


and one more thing if grid contains no data I am displaying  the grid with grid contains no data text, this as well is not exporting to pdf.

0
Ram
Top achievements
Rank 1
answered on 25 Mar 2009, 12:07 PM
This is the continuation to my previous post

When my grid contains no records in it and when i try to export it to pdf , I am getting following error:

Adobe reader could not open 'RadGridExport[1].pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)


I am using acrobat reader 8.0 version


thanks,
0
Daniel
Telerik team
answered on 25 Mar 2009, 01:30 PM
Hello Ram,

This behavior was already fixed by our developers.
I suggest you download the latest internal build from the following link:
Latest internal builds

Regarding the previous question: I'm afraid that the code-snippet you shared below is not enough for me to provide straight-to-the-point answer. I strongly recommend you isolate the problem in a simplified working project and attach it to a support ticket to be debugged locally.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Ram
Top achievements
Rank 1
answered on 25 Mar 2009, 02:59 PM
I downloaded the latest internal build folder Telerik.Web.UI_2009_1_324_trial_hotfix

How can I deploy that?
0
Ram
Top achievements
Rank 1
answered on 25 Mar 2009, 04:40 PM
Can you provide me your contact number because I need to fix this issue ASAP

Thanks,
0
Daniel
Telerik team
answered on 25 Mar 2009, 05:10 PM
Hello Ram,

Have a look at the following article:
Using the HOTFIX (DLLs only)

I recommend you use our Telerik Support Portal where you can find an answers for your questions instantly.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Ram
Top achievements
Rank 1
answered on 26 Mar 2009, 06:28 AM
Thanks for the reply this issue is solved now
0
Ram
Top achievements
Rank 1
answered on 26 Mar 2009, 12:15 PM
Hi,

I have one more question

My dll is in GAC, So Do I need to completely uninstall the older version and install the new hot fix.

because I tried by uninsatlling older version and insatalling new one the application works fine.

And when I have the both the version in GAC and in one of my webform I am refering old one and in other I am refering old one and both pages are having radgrid control, So when I try to compile the application I am getting follwing error that

radgrid containg in both the versions

So here my question is can I have both the versions in GAC and can I use them in one apllication



Thanks,
0
Daniel
Telerik team
answered on 31 Mar 2009, 10:52 AM
Hello Ram,

Although you can have a multiple versions of Telerik.Web.UI in GAC,  it's not possible to mix different versions.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
John Fussell
Top achievements
Rank 1
answered on 30 Apr 2009, 01:03 PM
Daniel,

I have exactly the same error message, in both IE6 and IE7.  I have downloaded the latest Telerik.Web.UI.dll (2009.1.402.20) and applied it, but the same error still occurs.  (The new DLL is definitely being used, because the grid style has changed noticeably.)

To reiterate, I have an ASP.NET AJAX RadGrid and am executing ExportToPdf() on a button click.  I am prompted to Save or Open the document.  If I click Open, then Adobe Reader opens but displays the error message:
"There was an error opening this document. This file cannot be found"

Interestingly, if I choose to Save the document instead, then I can open it fine.

Thanks,
Jo.

p.s.  I am using Adobe Reader 8.1.4 with IE7 and 8.1.2 with IE6.
My colleague says it works okay for him with AR 7.1.0 and IE7.
And it fails for him with AR 7.0.8 and IE6.
But we cannot assume that every web user has AR 7.1.0.

0
Daniel
Telerik team
answered on 30 Apr 2009, 02:24 PM
Hello John,

Could you please attach a simple website which generates these problematic PDF files? It would also be helpful to examine the output file. I recommend you submit a formal support ticket and attach the aforementioned resources together with a reference (URL) to this forum thread.
I appreciate your cooperation.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John Fussell
Top achievements
Rank 1
answered on 11 May 2009, 02:33 PM
Daniel,

Apologies for the delay in replying.  By trying to create a simple demonstration website for you, I have narrowed down the problem.

On Page_Load, we call this method:

        /// <summary>
        /// Prevents a page being cached on the Client
        /// </summary>
        /// <param name="p_response">The Http Response for the page</param>
        public static void DisableCaching(HttpResponse p_response) {
            p_response.Expires = -1000;
            p_response.AddHeader("pragma","no-cache");
            p_response.AddHeader("cache-control", "private");
            p_response.CacheControl = "no-cache";
        }

If I comment out the last line, then the ExportToPdf() method works fine.  But I don't really want to remove this line permanently.  Do you know of any configuration setting for the RadGrid that I can make that will have the same effect?

Thanks,
John.
0
Daniel
Telerik team
answered on 15 May 2009, 11:28 AM
Hello John,

I'm afraid that the aforementioned line (CacheControl -> No Cache) causes problems under Internet Explorer 6. This is considered browser behavior and I believe you can't avoid it.
There was an error opening this document - Adobe Reader 6 and IE 6

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John Fussell
Top achievements
Rank 1
answered on 20 May 2009, 08:20 AM
I repeat:  I am testing on IE7.
0
Daniel
Telerik team
answered on 22 May 2009, 04:32 PM
Hello John,

We tried to reproduce the problem using Adobe Reader 8.1.4 and Internet Explorer 7 but unfortunately without avail.

We performed three tests total:
Windows XP / Internet Explorer 7
Windows Vista x86 / Internet Explorer 7
Windows XP / Internet Explorer 8


I'm not sure how to recreate your scenario completely. Please provide more details on your OS/browser version.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Ram
Top achievements
Rank 1
John Fussell
Top achievements
Rank 1
Share this question
or