We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Print

Can someone give me a sample code that shows how to define a printing area of: -1 page (in landscape and portrait) -2 pages (in landscape and portrait) I always have 4 pages James Kle Hordf.inc

5 Replies

AD Administrator Syncfusion Team April 27, 2006 09:20 AM UTC

I have very hard time understanding how printing works. I have a A4 paper: [Model] Height: 1056,Width 816 [View] Height: 509,Width 594 [View.PageSettings] Height: 1169,Width 827 If like you say, it paginates the Model to find the number of pages, why do i have 4 pages ! I understand the view does not reflect the printe page Please give a sample that shows how to control the number of pages.


AD Administrator Syncfusion Team April 27, 2006 09:51 AM UTC

int h = dgr.View.PageSettings.Bounds.Height; int w=dgr.View.PageSettings.Bounds.Width; [should be 2100milleter,2970 millimeter] float pH = Syncfusion.Windows.Forms.Diagram.Controls.Diagram.Measurements.Convert(GraphicsUnit.Millimeter, GraphicsUnit.Pixel, h); float pW = Syncfusion.Windows.Forms.Diagram.Controls.Diagram(GraphicsUnit.Millimeter, GraphicsUnit.Pixel, w); dgr.Model.Height = pH; dgr.Model.Width = pW; The model height is in the A4 format (2100,2970) and it still prints 4 pages!!??


AD Administrator Syncfusion Team May 12, 2006 05:38 AM UTC

Hello James, My apologies for the delay in providing you with an update. The number of pages used for printing can be controlled by updating the Height/Width of the Diagram Model.The Essential Diagram printing implementation uses the size of the Diagram Model and the printer page setting for calculating the number of pages to be rendered while printing.The cause for this issue is that ,if the Model bounds are larger, the diagram control will attempt to paginate and print the entire model. You can avoid this condition by calculating the occupied bounds of the Diagram Model by taking into account the bounds of each node, and temporarily setting the Model Bounds property to be equal to this node bounds before invoking the print call.Try to set the height of the Model greater than the page height and so the diagram gets printed in 2 pages. Please, refer and replace your code block with this wherein I have made small changes to get the Symbols printed in 2 pages., // The desired page size is 21 x 29.7 centimeters and the margins are of size 1 inch or 25 mm. int h = 260; int w = 260; float pH = Syncfusion.Windows.Forms.Diagram.Measurements.Convert(GraphicsUnit.Millimeter, GraphicsUnit.Pixel,(2970 - (h*2))/10); float pW = Syncfusion.Windows.Forms.Diagram.Measurements.Convert(GraphicsUnit.Millimeter, GraphicsUnit.Pixel,(2100 - (w*2))/10); // Set the Model height to twice the page height and the Model width to page width diagram1.Model.Height = pH*2; diagram1.Model.Width = pW; I hope this information will help you.Please let me know if you have any further queries regarding this. Thanks for your patience. Regards, Praveena.


PR Priyatharcini November 15, 2007 08:51 AM UTC

We are using Syncfusion v5.2. While printing diagram has printed in 2 pages instead of single page. Tried to implement the solution given by your team. Unfortunately, having problem. How do we handle this solution in 5.2?

>Hello James,
>
>My apologies for the delay in providing you with an update.
>
>The number of pages used for printing can be controlled by updating the Height/Width of the Diagram Model.The Essential Diagram printing implementation uses the size of the Diagram Model and the printer page setting for calculating the number of pages to be rendered while printing.The cause for this issue is that ,if the Model bounds are larger, the diagram control will attempt to paginate and print the entire model.
>
>You can avoid this condition by calculating the occupied bounds of the Diagram Model by taking into account the bounds of each node, and temporarily setting the Model Bounds property to be equal to this node bounds before invoking the print call.Try to set the height of the Model greater than the page height and so the diagram gets printed in 2 pages.
>
>Please, refer and replace your code block with this wherein I have made small changes to get the Symbols printed in 2 pages.,
>
> // The desired page size is 21 x 29.7 centimeters and the margins are of size 1 inch or 25 mm.
>
> int h = 260;
> int w = 260;
>
> float pH = Syncfusion.Windows.Forms.Diagram.Measurements.Convert(GraphicsUnit.Millimeter, GraphicsUnit.Pixel,(2970 - (h*2))/10);
> float pW = Syncfusion.Windows.Forms.Diagram.Measurements.Convert(GraphicsUnit.Millimeter, GraphicsUnit.Pixel,(2100 - (w*2))/10);
>
> // Set the Model height to twice the page height and the Model width to page width
>
> diagram1.Model.Height = pH*2;
> diagram1.Model.Width = pW;
>
>I hope this information will help you.Please let me know if you have any further queries regarding this.
>
>Thanks for your patience.
>
>Regards,
>Praveena.
>



J. J.Nagarajan Syncfusion Team December 8, 2007 03:23 AM UTC

Hi Darsini ,

Sorry for the delay in getting back to you.

Please use the below code snippet to print the diagram in two pages.

[C#]

int h = 460;
int w = 260;

float pH = Syncfusion.Windows.Forms.Diagram.MeasureUnitsConverter.Convert((2970 - (h * 2)) / 10,MeasureUnits.Millimeter, MeasureUnits.Pixel );
float pW = Syncfusion.Windows.Forms.Diagram.MeasureUnitsConverter.Convert((2100 - (w * 2)) / 10,MeasureUnits.Millimeter, MeasureUnits.Pixel );

diagram1.Model.Size = new SizeF(pW, pH * 2);


Please let me know if you have any questions.

Regards,
Nagaraj


Loader.
Live Chat Icon For mobile
Up arrow icon