One of either Get/SetRectCoordinatesOnDocumentInch has a bug
Posted: Fri Jul 17, 2015 4:19 am
In our application, we allow the user to define a rectangle on a PDF document using the WPF GdViewer control. When we use SetRectCoordinatesOnDocumentInch, and immediately call GetRectCoordinatesOnDocumentInch, the coordinates returned to not match what was passed to set. Here is some sample data.
double left = 0, top = 0, width = 0, height = 0;
DocumentViewer.SetRectCoordinatesOnDocumentInch(0.217080444, 0.226247683, 3.48402667, 0.363420218);
DocumentViewer.GetRectCoordinatesOnDocumentInch(ref left, ref top, ref width, ref height);
The results we get are
left
0.11824942749237347
top
0.226247683
width
3.48402667
height
0.363420218
There is something either wrong with the set method where it sets the wrong coordinates, or there is something wrong with the get method returning incorrect coordinates. Either way, there is some incorrect behavior. I want to blame the set method more, because the rectangle does not appear in the correct location.
Or, is there something else about the GdViewer that might be impacting the behavior of these two methods, that we might need to correct in our code?
We are observing this behavior on our existing documents, and we want to note that everything works fine using the prior version of our application, which uses GdPicture9 and the WinForms viewer. The code is virtually identical between the two, other than the minor naming differences from the changes to the WPF stuff.
There is definitely a bug I think, or broken backwards compatibility in terms of how the WPF documentViewer handles this compared to the old WinForms viewer.
double left = 0, top = 0, width = 0, height = 0;
DocumentViewer.SetRectCoordinatesOnDocumentInch(0.217080444, 0.226247683, 3.48402667, 0.363420218);
DocumentViewer.GetRectCoordinatesOnDocumentInch(ref left, ref top, ref width, ref height);
The results we get are
left
0.11824942749237347
top
0.226247683
width
3.48402667
height
0.363420218
There is something either wrong with the set method where it sets the wrong coordinates, or there is something wrong with the get method returning incorrect coordinates. Either way, there is some incorrect behavior. I want to blame the set method more, because the rectangle does not appear in the correct location.
Or, is there something else about the GdViewer that might be impacting the behavior of these two methods, that we might need to correct in our code?
We are observing this behavior on our existing documents, and we want to note that everything works fine using the prior version of our application, which uses GdPicture9 and the WinForms viewer. The code is virtually identical between the two, other than the minor naming differences from the changes to the WPF stuff.
There is definitely a bug I think, or broken backwards compatibility in terms of how the WPF documentViewer handles this compared to the old WinForms viewer.