PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Concatenate Code don't work with Framework 4.0
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1165
Page 1 of 1

Author:  dsmauricio [ Tue May 04, 2010 1:50 am ]
Post subject:  Concatenate Code don't work with Framework 4.0

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/