Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Set page size of a diagram (Read 2474 times)
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Set page size of a diagram
Jan 17th, 2012 at 10:36am
Print Post  
Hello, i tried to set a page size for printing of a diagram like this:

Code (CSS)
Select All
diagram.DocumentPaginator.PageSize = new Size(width, height); 



PageSize will not be set. How can i set a custom page size for printing.

Amosius
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Set page size of a diagram
Reply #1 - Jan 17th, 2012 at 12:21pm
Print Post  
Below is the Print method code, so it seems it overrides your size with the page size selected in the printer setup dialog. You could create your own XpsDocumentWriter to use with a custom page size instead of calling Print:

Code
Select All
public void Print()
{
    PrintDocumentImageableArea ia = null;
    XpsDocumentWriter w = PrintQueue.CreateXpsDocumentWriter(ref ia);

    if (w != null)
    {
        DiagramPaginator dp = (DiagramPaginator)DocumentPaginator;
        dp.PageSize = new Size(ia.MediaSizeWidth, ia.MediaSizeHeight);
        w.Write(dp);
    }
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: Set page size of a diagram
Reply #2 - Jan 17th, 2012 at 3:37pm
Print Post  
Hello Stoyan, yes this helped me. I created custom Print() / Printpreview(...) methods.
Thank you.

Amosius
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint