I have a jasper report set to portrait letter, which, in pixel terms, translates to 612 x 792 in iReport. I have the left margin set to 17 pixels and the right set to 10. That leaves the single column width at 585 with no spacing.
Now, I have two vertical lines that are used to form the report's border, and they're positioned at x-coordinates 0 (for the left bar) and 585 (for the right). When this reported is executed, the resultant PDF looks perfectly fine. However, when I go to print, the two vertical lines are missing, and I have to select shrink to fit (which sets the zoom to 94% and displays everything).
I've done some experimenting, and, without shrinking the report at print time, the vertical lines need to be positioned at x-coordinates 2 (for the left) and 575 (for the right) in order to display, which translates into essentially an x-margin of 19 pixels. Playing around some more, if I set the left margin to 19, the left vertical bar displays at print time when positioned at x-coordinate 0.
Is something else setting the margins at 19 pixels aside from the jasper report itself? I can't find any culprits in the report itself that seem to be responsible for the discrepancy. Any help is greatly appreciated.
Most printers can't print up to the edge of a page. It sounds like you are hitting this limit. The print driver is detecting that the PDF doesn't fit inside the printer's printable area and allows you to shrink the content to fit what the printer supports.
This is just a guess. In my reports I use the Background-Band in iReport and draw a rectangle for the background of my reports.
Related
I'm having trouble setting up constraints.
This is the thing I am trying to achieve:
I have 2 objects A and B. I want there there to be a maximum of 100 points between A and B if its a larger screen, or less if its a smaller screen.
Also, I want there to be a minimum of a 20 point margin from the main view controller. So on a smaller screen the minimum spacing will be 20 points, and on a larger screen the margin can be as wide as needs in order to satisfy the space between A and B at 100 points.
To illustrate how I want it to look on various screens:
4 inch screen
I want there to be a 20 point margin on either side and the middle (space between A and B) can be variable, i.e. 100 or less.
5.5 inch screen
The margins can be variable and expand as large as they need to, but the middle section (space between A and B) can be a maximum of 100.
Any help how to achieve this would be greatly appreciated.
This can be achieved with help from three dummy views and two width constrains with different priorities. I set up a test project to test my thought. check it out to see whether it's what you needed
https://github.com/dopcn/testSeg
I have now been bashing my head against this problem for a couple of hours and figured it was time to ask somebody else.
I have 2 views that must be the same size, within these two views there are 2 boxes (green and blue in the pictures below), which are of variable sizes, and a box (pink'ish) that is fixed size.
Here is a sample image:
The green and pink boxes are set to be at the top, and the blue box floats underneath them. The blue box should never be further down than 15pt from the lowest of the other two boxes. This means that if the green box becomes smaller (as seen in the next image), then the blue box should stay 15pt from the pink box.
Lastly, since the cells are fixed height then if the blue box becomes smaller, then it should stay at the other boxes, but leave space below itself to fill out the rest of the view (since it must be as big as the view next to it), as I tried picturing here:
The key point here is that we are working on the smaller view of the two.
(The green and blue boxes are both labels with text that must be at the top of the box.)
The best solution I've come up with is to add:
green.bottom >=15 blue.top
pink.bottom >=15 blue.top
blue.bottom >=15 superview.bottom
But I get an "Inequality Constraint Ambiguity" between them, because inequality is not "good enough".
You need to add two more constraints between the blue view and the green and pink views. The should be,
green.bottom == 15 blue.top priority 900
pink.bottom == 15 blue.top priority 900
Your >= constraints have the default priority of 1000, meaning that they are required. This will ensure that neither view is ever closer than 15 points to the blue view. Adding these new equal constraints with a lower priority, means that the system will try to satisfy them, but it doesn't have to. This will result in the system satisfying which ever of those two equal constraints that it can, without violating the >= constraints.
I'm not exactly sure what constraint you need to the bottom of the view (from the blue view) since I'm unsure what size you want it to be.
I have a report in which a multi-column subreport is placed on my TfrxMasterData band. At design time, the report looks like this:
And the subreport looks like this:
I want to draw a frame around my data band, so I placed a TfrxShapeView on MasterData1 with Align = baClient and Shape = skRectangle. As long as the subreport does not exceed the design-time height of MasterData1, everything looks fine. But when there is more than four lines of data, my shape does not extend and the result looks like this:
Notice the gap between data bands? It seems that while my subreport correctly stretches to display additional lines, the shape on my master data band is not notified of this despite being aligned to baClient. Any thoughts?
I'm using FastReport 4.13.
According to FastReport manual, you have to set SubReport.PrintOnParent and MasterData.Stretched to True in order for the parent band to be stretched to match subreport's height.
I just tried this on one of my reports and I think it is doing what you want. I put the TfrxShapeView onto a TfrxSubdetailData (which is the data band that stretches in my report). On the TfrxSubdetailData, I checked the Stretched option to make it true. I aligned the TfrxShapeView to alClient and it worked. Maybe you are just missing checking the box to have the data band stretch.
I have been adding icons to my mobile control Line Item controls and haven't quite figured out what the preferred size of these icons should be. The CSS has max size settings of 35 by 35px.
The reason I ask this is because the icons don't seem to line up correctly. The CSS positions them at 0 0. If all else fails I may modify CSS and position them to something other than 0 0.
Still interested in hearing how you have dealt with this.
In the teamroom template, the mobile view for Recent Activity has icons that line up with the text. All these images are 16 X 16px.
There will never be 1 fit for all, the layout will be dependant on font size, row height and where you want it to line up. Some people may want it to align in the middle vertically and others will want it to align with the title in the row.
I would say 21px x 21px. but that depends on what font-size you are using.
Icon size can depends upon the applicaton. Normal size is 32x32 and an extended icon size is 64x64. If you want to line up the icons, you might have to change the icons to a standard size.
I have a Delphi form with TImages on it. Actually, it's a "fake" desktop with "icons" (the TImages).
When the user resizes the form (scales it or maximizes it, for example) the icons on the form should align proportionally.
Right now, I'm doing something like this with the images:
ImageX.Left:=Round(ImageX.Left * (Width / OldWidth));
ImageX.Top:=Round(ImageX.Top * (Height / OldHeight));
Now this is OK, as long as I start to make the maximized form smaller.
In that case the rightmost images are cut in part by the form's border (they're off the form's client area).
If I reposition these images to fit the client area, then the position of the icons get distorted upon scaling back to maximum size.
Any ideas for a better algorithm/fix?
Thanks!
First of all, you can't have a correctly scaled desktop when you only move the images, and don't scale them as well. You can do slightly better by moving the midpoints of your images, not their top left corner. It still won't be perfect, but it will work better. Of course, now the images will be cropped on all four sides, not just bottom and right, but at least it will be symmetrical :-)
Second, you will get accumulative rounding errors since you constantly override the "original" values (ImageX's top and left coordinate). You'd be better off having the original values stored in some sort of collection or array, and setting the new position based on the original value, rather than the previous value.
Something like this:
ImageX.Left:=Round(ImageX_OriginalLeft * (Width / Original_Width));