PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 5:37 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Migradoc WPF Printing
PostPosted: Wed May 12, 2010 10:27 am 
Offline

Joined: Sun Nov 29, 2009 11:16 am
Posts: 5
I have followed the instructions to print a Migradoc WPF Document, but I don´t know how to set the printing defaults:
Code:
            string dll = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document);

            MigraDoc.Rendering.Forms.DocumentPreview docPre = new MigraDoc.Rendering.Forms.DocumentPreview();
            docPre.Ddl = dll;


            MigraDoc.Rendering.DocumentRenderer renderer = docPre.Renderer;
                       
            System.Windows.Controls.PrintDialog dialog = new System.Windows.Controls.PrintDialog();
            dialog.UserPageRangeEnabled = true;
            bool? result = dialog.ShowDialog();

            if (result == true)
            {
                MigraDoc.Rendering.Printing.MigraDocPrintDocument printDocument = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();

                // Attach the current printer settings   
               printDocument.PrinterSettings = ???????????????;
               
               if (this.printerSettings.PrintRange == PrintRange.Selection)

                printDocument.SelectedPage = ???????.Page;                                 
                printDocument.Renderer = renderer;

                printDocument.Print();
            }


Is it a way in WPF???


Top
 Profile  
Reply with quote  
PostPosted: Wed May 12, 2010 1:55 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
I don't know how to set these parameters.

Bad news: currently printing doesn't work with the WPF build. Use the GDI build for that.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 13, 2011 11:56 am 
Offline

Joined: Fri Sep 03, 2010 6:18 pm
Posts: 5
Location: Munich (Germany)
Are there any news concerning this subject? I need a way to print a MigraDoc.DocumentObjectModel.Document (in WPF) directly.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 13, 2011 12:26 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Zoidberg wrote:
I need a way to print a MigraDoc.DocumentObjectModel.Document (in WPF) directly.

You can use the GDI+ build of PDFsharp/MigraDoc even for WPF applications.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 03, 2012 3:23 pm 
Offline

Joined: Thu Nov 24, 2011 1:56 pm
Posts: 2
Thomas Hoevel wrote:
Zoidberg wrote:
I need a way to print a MigraDoc.DocumentObjectModel.Document (in WPF) directly.

You can use the GDI+ build of PDFsharp/MigraDoc even for WPF applications.


So it is not possible to use the WPF DocumentViewer and to directly print documents both in the same program?

Such a pity! Where is the problem? Printing from the documentviewer works, so it should be possible, not?

Kind regards,
Sam


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 03, 2012 6:29 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 343
It's a bug in version 1.31. I hope it will be fixed with the next release.

Should be a simple problem, but we did not investigate it yet.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 06, 2012 9:00 am 
Offline

Joined: Thu Nov 24, 2011 1:56 pm
Posts: 2
Ah ok, the old issue with too much work and too little time.

Thanks for the explanation! I just wondered if there might be a tough technical problem hidden here.

The next release is not really imminent, due to the same reasons, I guess?

Ah, I see. In WPF the printing routines are not yet converted from System.Drawing.Printing to System.Printing? Pity, the routines behind MigraDoc are great!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group