Good morning everybody...

the following code works well in .aspx page that is in
web application..
now the same thing i want to do in windows form application.. can anybody help me..

The code is for without saving the pdf file take a print..
it works well in .aspx page

ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
MemoryStream oStream; // using System.IO
oStream = (MemoryStream)
cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();

In windows form the Response .clear or response.buffer is not supported
error is missing namespace or directive is displaying...

Use cryRpt.ExportToDisk method.

if i use the cryRpt.exporttodisk then it will save to the disk..
i dont want to save the file i want to use the buffer and
i want to take the print..
the following is my code.. in windows form

ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
//MemoryStream oStream; // using System.IO
// oStream = (MemoryStream)
cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
CrDiskFileDestinationOptions.DiskFileName = (oStream.ToString()); 
CrExportOptions = cryRpt.ExportOptions;
{
 CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
 CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
 CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
 CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryRpt.Export();
}

Hi vinayak.v

Please read member-rule before posting again. Members who break a rule will usually be warned, followed by a points-based infraction for subsequent offenses.

Keep it Clear
1. Do post in full-sentence English
2. Do wrap your programming code blocks within [code] ... [/code] tags
3. Do use clear and relevant titles for new threads
4. Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

>i want to take the print..

Use cryRpt.PrintToPrinter() method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.