Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) printing in net diagram (Read 7354 times)
keropi
YaBB Newbies
*
Offline



Posts: 9
Joined: Oct 3rd, 2008
printing in net diagram
Oct 13th, 2008 at 10:49am
Print Post  
Hi, can someone let me know how to print the diagram using the net diagramming?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #1 - Oct 13th, 2008 at 10:58am
Print Post  
Hi,

Since the ASP.NET process cannot access the printer, you cannot print on the server side. You could either call print() on the client side in JavaApplet mode, or use PdfExporter to create a PDF file and let the user print it. Another option is to run a Windows process that polls a directory for new diagram or PDF files and prints them.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
keropi
YaBB Newbies
*
Offline



Posts: 9
Joined: Oct 3rd, 2008
Re: printing in net diagram
Reply #2 - Oct 13th, 2008 at 12:03pm
Print Post  
Hi, thank you for your help, Will try the pdf way now.
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #3 - Jul 15th, 2009 at 8:00pm
Print Post  
Hello, I was reviewing this thread thinking too that there was a diagramView.print() function for NetDiagram. Since October last year has any changes been made to allow printing for NetDiagram? Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #4 - Jul 16th, 2009 at 6:16am
Print Post  
Is there any problem when calling diagramView.print() ?
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #5 - Jul 16th, 2009 at 12:25pm
Print Post  
Yes, where ever I try to use the method, I receive an error that it does not exist. I tried it in the javascript too:

protected void btnPrint_Click(object sender, EventArgs e)
       {  MindFusion.Diagramming.WebForms.DiagramView.print(); //errors that there is no definition for print()
       }

and I tried

function printDiagram() {
           alert("gothere");
           var dvApplet = document.getElementById("diagramView");
           var dv = dvApplet.getDiagram();
           dv.print(); }
//errors object does not support property or method

I looked in the documentation and believe I am using it correctly. Any thoughts?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #6 - Jul 16th, 2009 at 12:36pm
Print Post  
print() is a method of DiagramView. Try this:

dvApplet.getDiagramView().print();

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #7 - Jul 16th, 2009 at 12:38pm
Print Post  
Works! Thanks!
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #8 - Jul 16th, 2009 at 12:49pm
Print Post  
Now that I can see the area that it prints, it cuts off the left part of the diagram whats wider than the page if its in portrait mode. It scales the diagram to the proper height to fit on the page, but doesn't scale the width to fit. And vice versa for  the landscape print mode.

Please let me know if there is anything I can do to fix this  Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #9 - Jul 16th, 2009 at 1:13pm
Print Post  
The control does not scale automatically the diagram to fit the page. Are you printing to a real printer or some kind of a pdf printer?
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #10 - Jul 16th, 2009 at 1:15pm
Print Post  
a real printer. I printed a test page.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #11 - Jul 16th, 2009 at 2:59pm
Print Post  
Are you changing anything in DiagramView.PrintOptions?

I've added this to the OrgBrowser sample and printed a large tree, the result seems ok:

Code
Select All
<button onclick="onPrint();">Print</button>
<script language="javascript" type="text/javascript">
function onPrint()
{
	var fcApplet = <%= fc.AppletElement %>;
	fcApplet.getDiagramView().print();
}
</script>
 



Could you try this with your printer? You might check if there aren't some strange margin and scale values set in the printer properties window as defaults.

Stoyan
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #12 - Jul 16th, 2009 at 3:41pm
Print Post  
Thanks Stoyan, the problem is on my end, probably has something to do with my pixel units.

I dropped that code into the OrgBrowser sample and it works perfect. I'll continue to mess with my code to get it to work like this default example.
  
Back to top
 
IP Logged
 
bkernan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 28th, 2009
Re: printing in net diagram
Reply #13 - Jul 16th, 2009 at 6:08pm
Print Post  
Hello,

Yeah my diagram was not fitting within the page like the example you provided works because my units are in pixels.

In OrgBrowser sample in the code behind I added:

d.MeasureUnit = GraphicsUnit.Pixel;

and this replicated the problem I am having printing.

using zoomToFit(); zooms the diagram in the applet in the browser, not the diagram the is printed.

I have messed around with some other setting and have not come up with a solution. I cannot set the units to 'units' instead of pixels right before I print because that would make my images and text positioning and proportions off.

Any ideas?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: printing in net diagram
Reply #14 - Jul 17th, 2009 at 1:41pm
Print Post  
Hi,

I've set the unit to Pixel and the tree was printed with the same size as on the screen. I didn't call zoomToFit - this method is intended to fit the diagram inside the view on screen, do you expect the diagram to fit on a single printed page after calling it?

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint