コード例 #1
0
ファイル: Program.cs プロジェクト: GorelH/PdfSharp
    internal static void RenderPdfToStream(MemoryStream streamToWriteTo, BaseDocument document)
    {
      document.DrawDocument();

      var printer = new MigraDoc.Rendering.PdfDocumentRenderer();
      printer.Document = document.Document;
      printer.RenderDocument();
      printer.PdfDocument.Save(streamToWriteTo, false);
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: yolpsoftware/PdfSharp
        internal static void RenderPdfToStream(MemoryStream streamToWriteTo, BaseDocument document)
        {
            document.DrawDocument();

            var printer = new MigraDoc.Rendering.PdfDocumentRenderer();

            printer.Document = document.Document;
            printer.RenderDocument();
            printer.PdfDocument.Save(streamToWriteTo, false);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: GorelH/PdfSharp
    private static void GenerateAndOpen(BaseDocument document)
    {
      var pdfStream = new MemoryStream();
      try
      {
        RenderPdfToStream(pdfStream, document);

        // Reset stream
        pdfStream.Position = 0;
        var documentPath = new FileInfo("test.pdf");
        File.WriteAllBytes(documentPath.FullName, pdfStream.ToArray());

        //Start the process 
        Process proc = Process.Start(documentPath.FullName);
      }
      finally
      {
        pdfStream.Dispose();
      }
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: yolpsoftware/PdfSharp
        private static void GenerateAndOpen(BaseDocument document)
        {
            var pdfStream = new MemoryStream();

            try
            {
                RenderPdfToStream(pdfStream, document);

                // Reset stream
                pdfStream.Position = 0;
                var documentPath = new FileInfo("test.pdf");
                File.WriteAllBytes(documentPath.FullName, pdfStream.ToArray());

                //Start the process
                Process proc = Process.Start(documentPath.FullName);
            }
            finally
            {
                pdfStream.Dispose();
            }
        }