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

PdfDocument.Save(Stream) - Fails: No Pages
https://forum.pdfsharp.net/viewtopic.php?f=2&t=446
Page 1 of 1

Author:  Brian [ Fri Aug 08, 2008 1:24 pm ]
Post subject:  PdfDocument.Save(Stream) - Fails: No Pages

I am using a function like the one below to expose a pdf as a stream. PDFDoc is a PdfDocument object that was opened using a file-path pointing to a PDF created by Crystal Reports 2008. In debug mode everything works fine, but at runtime the Pages collection is null so the save operation fails. It seems like a stream buffer needs to be flushed. Am I doing something wrong?

Code:
public override System.IO.Stream GetData()
{
   System.IO.Stream pStream;
   System.IO.MemoryStream mStream;
   
   if (IsOpen)
   {
      mStream = new System.IO.MemoryStream();
      pStream = (System.IO.Stream)mStream;

      PDFDoc.Save(pStream,false);
            
      return pStream;
   }

   return null;
}


TIA,

Using PdfSharp 1.2.1269

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