We have Infragistics 2009 v2. Old I know, but we are upgrading soon.
I am using the Infragistics.Documents.Reporting. I have looked through the knowledge base and haven't seen any bug fixes listed for this so I thought I would post it.
Consider the following Code
Report rpt = new Report(); Infragistics.Documents.Report.Section.ISection section = rpt.AddSection(); section.PageSize = Infragistics.Documents.Report.PageSizes.Letter; Infragistics.Documents.Report.ISite site = section.AddSite(); Infragistics.Documents.Report.ICanvas canvas = site.AddCanvas(0F, 0F); Graphics gpx = canvas.CreateGraphics(); gpx.PageUnit = GraphicsUnit.Pixel;
At this point if you check gpx.DpiX and Y they are both 96. PageSize is Letter. I would think that the canvas then should be 96 * 8.5 = 816 pixels across. This is not the case. Using the following code to draw a few lines (the pens are colored and 1 pixel wide).
gpx.DrawLine(pRed, new Point(610, 0), new Point(610, 100)); gpx.DrawLine(pGreen, new Point(611, 0), new Point(611, 100)) gpx.DrawLine(pBlue, new Point(612,0), new Point(612, 100)); gpx.DrawLine(pBlack, new Point(620, 0), new Point(620, 100));
rpt.Publish(@"C:\InfraReport_PDF.pdf",FileFormat.PDF);
On the resulting PDF I can just make out the Green line at 611 and if I zoom in I can see what appears to be 1/2 the Blue line. I would have thought that 816 would have been the right hand boundary since I created the canvas at 0,0. I can easily put a mark at 1,1.
What am I missing? Is this a bug, or just a lack of understanding?
Thanks Mike, that makes sense. We were starting to come to that conclusion.
For anyone else following this thread, by using a ScaleTransform you can scale your canvas to the size needed for the PDF.
The following converts from 96 dpi to 72dpi:
graphics.ScaleTransform(.75F, .75F);
Hi,
The Graphics object in the documents engine is just a proxy. It's basically a very simple proxy object and it really doesn't support a whole lot of the thing that the System.Drawing.Graphics object supports.
In this case, the DpiX and the PageUnit are not honored. The units for DrawRectangle are always in twips, and the values you specify are written directly to the PDF document with no translation.
Georgi:
I think you are missing my issue here. In this latest sample you went with Legal but then you oriented the paper landscape, effectively making it 11 inches wide.
Keep it in portrait mode, which makes the paper 8.5 inches wide and at 96DPI (which is what the canvas reports) the page should be 816 pixels wide, which the canvas also reports.
However; when the canvas is displayed on the PDF, it is cropped and only show 612 pixels (effective DPI of 72). This is shown in the attached image.
Try taking a portrait oriented page that is 8.5 inches wide and draw a line at the 8 inch mark (768 pixels in, you will find that the line does not appear in the PDF.
Hello Akeroo,
I change the paper size, but I still not able to reproduce your issue. Please take a look at the attached sample and please feel free to modify this sample to reproduce your issue and revert it back to me. I`ll be glad to research it. Could you please make few screenshots or video that show the issue.
Thanks and Regards
Thanks for taking the time to look into this.
In the video you chose a paper size of Ledger which is 11x17.
My issue was that I was choosing Legal (8.5x11). The canvas showed 96dpi, which means that it should be 816 wide. However, I am finding that it is only about 611 wide.
It appears that there is some sort of scaling going on. Also, I would like the canvas to be higher dpi then 96 but am not seeing how to do that either.
Any thoughts?