I have a code that runs ok in VS2008, it concatenates documents gererated on the fly from rdlc files, and if the document page count was odd, then the code concatenates a blank page (this is for duplex printing).
I just migrates to framework 4.0, the document are created, with the same file size, but the pages are blank when yuo open them in Adobe Reader.
this is the method code :
Code:
PdfDocument consolidado;
private void ConcatenaInforme(byte[] pdfAlumno)
{
PdfDocument original;
MemoryStream s = new MemoryStream(pdfAlumno);
original = PdfReader.Open(s, PdfDocumentOpenMode.Import);
int cnt = original.PageCount;
for (int idx = 0; idx < cnt; idx++)
{
PdfPage pagina = original.Pages[idx];
consolidado.AddPage(pagina);
}
if ( original.PageCount % 2 != 0 )
{
PdfPage page = new PdfPage();
consolidado.AddPage(page);
}
}
private void GrabaInforme()
{
if (consolidado.PageCount > 0)
{
consolidado.Save(HttpContext.Current.Server.MapPath("~/") + @"\Boletines\Boletin_Grado_" + gsGrado.Trim() + "_Periodo_" + gsPeriodo + ".pdf");
}
}
Someone can herlp me?
Regards,
Mauricio Atanache G.