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

Migradoc prints blank pages direct from ddl
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1147
Page 1 of 1

Author:  thagerbil [ Thu Apr 15, 2010 12:02 am ]
Post subject:  Migradoc prints blank pages direct from ddl

Hi,

as the title says, when printing a Document which is created from a stored DDL the pages are blank.

I use this code to print, it's a slightly modified sample code from the wiki, where I threw out the Preview component since I'm working in a web environment.
Code:
        public void Print(Document doc)
        {
            // Reuse the renderer from the preview
            DocumentRenderer renderer = new DocumentRenderer(doc);

            if (renderer != null)
            {
                renderer.PrepareDocument();
                int pageCount = renderer.FormattedDocument.PageCount;

                // Creates a PrintDocument that simplyfies printing of MigraDoc documents
                MigraDocPrintDocument printDocument = new MigraDocPrintDocument(renderer);

                printDocument.Renderer = renderer;

                printDocument.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.AllPages;
                printDocument.PrinterSettings.PrinterName = "Samsung CLP-310 Series";

                printDocument.Print();

            }

        }

The Document is created by using Document = MigraDoc.DocumentObjectModel.IO.DdlReader.DocumentFromString(ddl);

As said when calling this function I get all blank pages, I also have another function to generate the PDF from the same document and that one succeeds, so it's not a defective ddl or something.

What am I doing wrong?

Author:  Thomas Hoevel [ Mon Apr 19, 2010 7:16 am ]
Post subject:  Re: Migradoc prints blank pages direct from ddl

Hi!

Try the GDI+ build.

Author:  thagerbil [ Sat Jun 05, 2010 10:03 pm ]
Post subject:  Re: Migradoc prints blank pages direct from ddl

well, it took a while due to a VS2010 bug not letting me do "add reference" or "add existing project" anymore, but it seems that this is working for me.

thanks!

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