Skip to Content
avatar image
Former Member

Export into pdf raise an error?

Hai to all,

I'm using Crystal Report 11.5, Asp.net2.0-C#.

I dynamically bind some records to the report document. Now i write the code to export the data into pdf file.

BindEveryThing();

MemoryStream oStream; // using System.IO

oStream = (MemoryStream)

boReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

Response.Clear();

Response.Buffer= true;

Response.ContentType = "application/pdf";

Response.BinaryWrite(oStream.ToArray());

HttpContext.Current.ApplicationInstance.CompleteRequest();

The problem is after the above code reached

i'm getting two errors as

Adobe Reader cannot open CA2V0915.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 wasnt correctly decoded

Threre was an error openning this document Acrobat cannot open this file because there is a modal dialog open.

Experts please help me solve this problem>

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 01, 2008 at 01:09 PM

    Try adding a Response.End(); after you do the BinaryWrite.

    Add comment
    10|10000 characters needed characters exceeded

    • I think the place to start on all of this is with a simple sample app that does not use exportostream. Rather, simply export to pdf from the app. This file;

      https://smpdl.sap-ag.de/~sapidp/012002523100006252822008E/net_win_smpl.exe

      contains a number of sample apps. I'd start with vbnet_win_exportopdf and see if you can export from that app. Use a "saved data" report so you do not have to code the database logon.

      vbnet_win_simplepreviewreport may also be a good app. See if exporting from the viewer works.

      All of the above and the whole thread assumes (though the question was not posed) that you can export to pdf from the CR designer(?).

      Ludek

  • avatar image
    Former Member
    Oct 02, 2008 at 01:54 PM

    Hi,

    Generally, this kind of error message appears because by default the PDF file is saved to the temp folder. It could be that the temp folder on your computer is full and cannot accept any more files.

    Try to remove some files from the temp folder and see how it goes.

    Cheers

    Alphonse

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Alphonse Kouassi ,

      I cleared all temp files from my machine, but now also i have the same problem

      There was an error opening this document. This file is

      damaged and could not be repaired