I am running multiple reports and combining them into a single PDF file. For each report, I pass the datasource, parameters, and report path to the following. The result is a PDF file with the correct number of pages, but all pages are blank. What am I missing?
LocalReport report = null;
PdfDocument pdfDoc = new PdfDocument();
private void ProcessReport(
ReportDataSource reportDS,
ReportParameter[] reportParms,
string reportPath)
{
string format = "PDF";
string deviceInfo = null;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
Warning[] warnings = null;
string[] streamIDs = null;
report = new LocalReport();
report.EnableExternalImages = true;
report.ReportPath = reportPath;
if (reportParms != null)
report.SetParameters(reportParms);
if (reportDS != null)
report.DataSources.Add(reportDS);
Byte[] pdfArray = report.Render(
format,
deviceInfo,
out mimeType,
out encoding,
out extension,
out streamIDs,
out warnings);
//Stream s = new MemoryStream(pdfArray);
MemoryStream ms = new MemoryStream(pdfArray);
PdfDocument tempPDFDoc = PdfReader.Open(ms, PdfDocumentOpenMode.Import);
for (int i = 0; i < tempPDFDoc.PageCount; i++)
{
PdfPage page = tempPDFDoc.Pages[i];
pdfDoc.AddPage(page);
}
}
Please try generating the reports with a different setting as described in this thread: http://forum.pdfsharp.net/viewtopic.php?p=1613#p1613
If you provide us with some files that do not work, we can try to fix this in PDFsharp.