Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Inconsistencies in page sizes? (Read 4036 times)
Mukesh
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Inconsistencies in page sizes?
Nov 26th, 2008 at 8:40am
Print Post  
From the Programmer's guide, we understand that by default the Bounds of a Diagram will be set to the standard A4 size, which is 210 mm X 297 mm. In WpfPoints this is 793.7 X 1122.51.

I am using the default MeasureUnit of WpfPoint.

In the Window_Loaded function, I set the value of the GridSizeX to 793.7 and that of GridSizeY to 1122.51 (boundaries of a A4). The expectation was the each cell in the grid will have a size of A4. The code was as follows,

digDSTEditor.ShowGrid = true;
digDSTEditor.GridStyle = MindFusion.Diagramming.Wpf.GridStyle.Lines;
digDSTEditor.GridSizeX = 793.7;
digDSTEditor.GridSizeY = 1122.51;
digDSTEditor.GridOffsetX = 0;
digDSTEditor.GridOffsetY = 0;
digDSTEditor.AlignToGrid = false;

Initially the grid lines were not shown because we had the page size equal to the grid cell size (so only one cell). So far so good

I created a node and dragged it towards right to the extent that a new cell was created and vertical grid line appeared. I left the node just next to the vertical grid line (a few millimeters away from it).

I exported this diagram to PDF (PageSize = A4, orientation = Portrait, AutoScale=false, AutoOrientation = false). I expected that the two pages would be created, which it did. The code for export was as follows,

MindFusion.Diagramming.Wpf.Export.PdfExporter exporter = new MindFusion.Diagramming.Wpf.Export.PdfExporter();
exporter.AutoOrientation = false;
exporter.AutoScale = MindFusion.Diagramming.Wpf.Export.AutoScale.None;
exporter.PageSize = MindFusion.Pdf.PageSize.A4;
exporter.PageOrientation = MindFusion.Pdf.PageOrientation.Portrait;
exporter.Margins.Top = 0;
exporter.Margins.Bottom = 0;
exporter.Margins.Right = 0;
exporter.Margins.Left = 0;

String path = @"c:\sampleExport.pdf";
exporter.Export(digDSTEditor, path);

However, the position of the node in the second page did not match the position of the node on the Diagram? In the Diagram, it was just a few millimeters away from the left, however, in the PDF it is far towards the right.

Am I doing something wrong or expecting something wrong?

I can send the screen shot of the diagram and also the PDF if required.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inconsistencies in page sizes?
Reply #1 - Nov 26th, 2008 at 1:35pm
Print Post  
Indeed, the first problem I can see is that PdfExporter incorrectly uses 72 DPI for WpfPoint, instead of 96 DPI. As a workaround, you could set pdfex.Scale = 72f / 96f * 100 for the time being. Unfortunately this still does not align the node perfectly to the page boundary. PDFs have some strange cropbox, bleedbox, trimbox etc. attributes for which we are using default values, and perhaps the difference comes from them. Our developer will check for some way to implement what you need later this week.

Stoyan
  
Back to top
 
IP Logged
 
Mukesh
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Re: Inconsistencies in page sizes?
Reply #2 - Nov 28th, 2008 at 4:34am
Print Post  
Thanks for the information. However, as you said it still does not work.

It will be great if the developer could provide us with clues so that we can complete our deliveries to the customer.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inconsistencies in page sizes?
Reply #3 - Nov 30th, 2008 at 1:24pm
Print Post  
If you are in a hurry, you could use this version:
https://mindfusion.eu/_temp/pdf_align.zip

It should let you align items to the page boundaries correctly, on the condition that all margins are set to 0. You still have to scale by 72 / 96, and note that we've changed the Margins type to the WPF's Thickness struct, so your initialization code should look like this:

Code
Select All
pdfex.AutoOrientation = false;
pdfex.AutoScale = AutoScale.None;
pdfex.Scale = 72f / 96f * 100;
pdfex.PageSize = MindFusion.Pdf.PageSize.A4;
pdfex.PageOrientation = MindFusion.Pdf.PageOrientation.Portrait;
pdfex.Margins = new Thickness(0, 0, 0, 0);
 



Our developer will try to fix the WpfPoint scale and implement this for margins greater than 0 in the next few days.

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


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Re: Inconsistencies in page sizes?
Reply #4 - Dec 1st, 2008 at 9:23am
Print Post  
Thanks for the new set of libraries.

It seems to be working fine for margins of 0. The page size as seen in the document properties also seems to be fine.

However, we definitely want to be able to leave a margin.

Also, I get label 'Trial version' on top left corner of canvas and hence in the exported PDF. Please let me know, what should I do (licenses upgrade etc) to get rid of 'Trial version' label?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inconsistencies in page sizes?
Reply #5 - Dec 1st, 2008 at 10:15am
Print Post  
Use the "Instant Message" icon on the left to send me a PM with your order number or company name, and I will send you licensed build of the assemblies.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inconsistencies in page sizes?
Reply #6 - Dec 1st, 2008 at 2:31pm
Print Post  
This version should work also with margins > 0:
https://mindfusion.eu/_temp/wpfdiag_pdf.zip

Now margins are specified in WPF 96 DPI points, so you set half-inch margins in the PDF like this:

pdfex.Margins = new Thickness(48, 48, 48, 48);

and don't forget to subtract the margins sizes from the grid size.

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


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Re: Inconsistencies in page sizes?
Reply #7 - Dec 2nd, 2008 at 5:15am
Print Post  
Thanks very much for the new set of libraries. We shall check this version out.

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