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

PDF Report not showing any content...

1 Answer 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Love
Top achievements
Rank 1
Michael Love asked on 27 Oct 2009, 11:06 PM
Hi there.

I had a PDF report working fine a bit ago and it stopped working and I think the only thing that changed was the database. One of my co-workers did a bunch of cleanup on his local version of the db, made a backup and I used that backup on my db now.

Anyway, that may or may not be the problem and I am looking for ideas.

A few important things to note about my report:

I am using a stored procedure, so I am manually making that binding happen in the code behind:

 

public My_Report()

 

{

InitializeComponent();

 

this.DataSource = null;

 

 

this.NeedDataSource += new System.EventHandler(this.My_Report_NeedDataSource);

 

}

 

private void My_Report_NeedDataSource(object sender, System.EventArgs e)

 

{

 

this.sqlConnection1.ConnectionString = ConfigurationManager.ConnectionStrings["MyDataContext"].ConnectionString;

 

 

 

//Transfer the ReportParameter value to the parameter of the select command

 

 

this.sqlDataAdapter1.SelectCommand.Parameters["@PersonID"].Value = this.ReportParameters["PersonId"].Value;

 

 

this.sqlDataAdapter1.SelectCommand.Parameters["@OperatorID"].Value = this.ReportParameters["OperatorId"].Value;

 

 

//Take the Telerik.Reporting.Processing.Report instance and set the adapter as it's DataSource

 

Telerik.Reporting.Processing.

Report report = (Telerik.Reporting.Processing.Report)sender;

 

report.DataSource =

this.sqlDataAdapter1;

 

 

// set the table datasource as well

 

table1.DataSource = report.DataSource;

 

// get the picture paths for the person and the company logo

 

pbPerson.Value =

this.ReportParameters["PersonPicturePath"].Value;

 

pbContractor.Value =

this.ReportParameters["ContractorPicturePath"].Value;

 

pbOperator.Value =

this.ReportParameters["OperatorPicturePath"].Value;

 

}

}

Also, I am creating the pdf and saving it to the file system, then opening the pdf as content in my page. Here is how I am save the pdf report to the file system:

 

 

void SaveReport(Telerik.Reporting.Report report, string fileName)

 

{

 

ReportProcessor reportProcessor = new ReportProcessor();

 

 

RenderingResult result = reportProcessor.RenderReport("PDF", report, null);

 

 

using (FileStream fs = new FileStream(fileName, FileMode.Create))

 

{

fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);

}

}

Then, my pdf shows as embedded content in my aspx page like this:

 

 

<EMBED id="showPDF" runat="server" type="application/pdf" width="750" height="550"></EMBED>

A bit more info:

I am able to run the sproc standalone from inside sql-server management studio with no problems. Also, a pdf report does get created, but it only has header information. The detail section which has the table based on the sproc and a picture box is simply blank.

Anyway, all of this was working in the very recent past and is not working now.

Any ideas on why this is happening would be greatly appreciated!

Mike

 

1 Answer, 1 is accepted

Sort by
0
Michael Love
Top achievements
Rank 1
answered on 30 Oct 2009, 03:27 AM
I was able to create the pdf correctly. I had some things out of sync in my project. As far as displaying correctly with the embed goes, that issue is outside of this forum.

Thanks, Mike
Tags
General Discussions
Asked by
Michael Love
Top achievements
Rank 1
Answers by
Michael Love
Top achievements
Rank 1
Share this question
or