Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Page size on printing (Read 6499 times)
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Page size on printing
Jan 28th, 2009 at 1:26pm
Print Post  
Hi there,

Is there possibility of specify the page size ?

I saw in the Pdf export is possible, but in printing ?

Cheers.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #1 - Jan 28th, 2009 at 2:57pm
Print Post  
Hi,

Try this:

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

if (w != null)
{
	DiagramPaginator dp = (DiagramPaginator)diag.DocumentPaginator;
	dp.PageSize = new Size(width, height);
	w.Write(dp);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #2 - Jan 28th, 2009 at 4:05pm
Print Post  
Work good for printing, but how could I do it for preview?

Cheers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #3 - Jan 28th, 2009 at 4:14pm
Print Post  
Using the same DiagramPaginator dp object,

Code
Select All
MemoryStream ms = new MemoryStream();
Package pkg = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);
string pack = "pack://temp.xps";
var uri = new Uri(pack);
PackageStore.AddPackage(uri, pkg);
XpsDocument doc = new XpsDocument(pkg, CompressionOption.NotCompressed, pack);
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(doc), false);
rsm.SaveAsXaml(dp);
var w = new Window();
DocumentViewer dv = new DocumentViewer();
dv.Document = doc.GetFixedDocumentSequence();
w.Content = dv;
w.Title = windowTitle;
w.ShowDialog();
PackageStore.RemovePackage(uri);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #4 - Jan 28th, 2009 at 4:22pm
Print Post  
Awesome ! Shocked

Thanks very much.
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #5 - Jan 28th, 2009 at 4:47pm
Print Post  
hummm... a small question...

When I try to pass the size of the diagram, the shapes appears giant, and if for example I have a diagram where there is just one shape and the diagram fit it, appears splitted in several pages...  I think that is a issue related with the DPI, have you any thought about where could I set that?

Cheers.
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #6 - Jan 29th, 2009 at 10:53am
Print Post  
Sorry but I don't get it, could you do a small example when you print the full diagram in a single page with the same size than the diagram?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #7 - Jan 29th, 2009 at 12:01pm
Print Post  
The code above works fine in my test app. You are specifying the page size in WPF 96dpi points, right? With what Diagram.Bounds and page size values are you seeing problems?
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #8 - Jan 29th, 2009 at 1:14pm
Print Post  
Possibly I'm misunderstanding something.

How do you translate the diagram bounds to page size?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #9 - Jan 29th, 2009 at 1:51pm
Print Post  
You don't; DocumentPaginator does that. So what are your diagram.Bounds and page size values?
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #10 - Jan 29th, 2009 at 3:28pm
Print Post  
I've built a small application, the I tried with several sizes and works fine, then I discover the problem that was make me obtain bad previews

I create a diagram, delete a couple of nodes,  ResizeToFitItems and preview, the diagram appears chopped.

I can provide a example if you need it: https://www.vtortola.net/files/DataBaseDiagramming.zip

Open the diagram, delete the two nodes at the top, click on the "fit" button in the toolbar, and then click "print" button.

Cheers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #11 - Jan 30th, 2009 at 9:28am
Print Post  
This version should fix that:
https://mindfusion.eu/_beta/wpfdiag211.zip

Cheers.
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #12 - Jan 30th, 2009 at 10:23am
Print Post  
Perfect man Smiley

So, when this beta is going to be released? (I can't release a version of our software with the "WpfDiagram 2.1.1 beta" Tongue )

Cheers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page size on printing
Reply #13 - Jan 30th, 2009 at 10:50am
Print Post  
When you stop reporting bugs Tongue We can send you a build without the label, but there are a few more unresolved problems, so you release on your own risk ...
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Page size on printing
Reply #14 - Jan 30th, 2009 at 1:10pm
Print Post  
Ok, we'll wait for the safe release Tongue
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint