How to align Image to right in iText? - image

I am adding image to a table cell. I want to position the image to the right of the cell.
I've tried this:
PdfPCell imagecell= new PdfPCell();
imagecell.add element(myImage);
imagecell.setHorizontalAlignment(Element.ALIGN_RIGHT);

Actually, I have got a solution for the question so thought it might be helpful to share it here.
The image can be aligned to the right of the table cell by specifying the alignment property of the Image object as shown below:
myImage.setAlignment(Image.ALIGN_RIGHT);

Related

How to add image in repeatbox object

I am new in Smartface software. I want to add image in repeatbox.
Can someone help me to add images in repeatbox.
Thanks
Just drag and drop it to the repeatbox like the picture below. Remember the layout is by default "Absolute". I have set my layout to linear below.

iText: Image in PdfpCell setAbsolutePosition does NOT work

I have a PdfPTable with 6 PdfPCell. I want to put an image in each cell at an absolute position. I just can get it to work, what am I doing wrong? As shown in the pic, the image always show on the to left (default) location.
laImage.scaleAbsolute(50, 50);
laImage.setAbsolutePosition(0, 100);
laCell.addElement(laImage);
The setAbsolutePosition() method can be used to define the absolute position on a page (using the coordinates of the page) when adding an image to a document using document.add(). It is very surprising to discover that somebody would be using that method to define a relative position in a PdfPCell.
Depending on what you really want, you could either change the padding of the PdfPCell (to create a distance between one or more of the cell borders and its content) or you could define a border for the Image object. This will introduce relative offsets.

How do I put a caption under an image in a table?

I am using tables to create a grid of movie posters, the only problem is how do I put a caption under each image without affecting the images alignment or anything else? Let me know

fo image align caption

I would like to have image with caption printed below the image in XSL-FO. the caption should have right alignment.
I am using table for that. It prints images with captions but the problem is the alignemnt of the caption compared to the caption. If the alignment of the image is 'right' then all looks fine: caption is just below the image at the right side. but if the image is center or left then still at the far right of the page.
The problem is the table is full width of the page but the image is smaller. The problem can be solved if the width and the alignment of the table corresponds to the width and the alignment of the image.
will really appreciate help to resolve this issue.
regards,
rnv
You might want to ensure the table is not taking the entire width of the page, but just the width it needs. This way, the table will be as wide as the image, and your caption will be aligned to the right, neatly under the image.
However, now you want your image to be in the center of the page. The solution could be to put the table in another table and let this outer table take the entire width of the page. A fo:block might also do the trick.

Table, rectangle placed on top of an image is not coming properly in preview mode in SSRS

I wanted to draw a rectangle with rounded corners in SSRS. But, after lot of research i got to know that currently there is no property for that. So, i am trying to use an image of a rectangle with rounded corners and on top of that trying to align the table and other controls within the image. But, when i am previewing it or exporting it to a PDF file, first the image is getting displayed, then below that all other controls comes. Am i doing anything wrong. Please let me know.
Why don't you try to enclose your image rectangle and other controls etc. within an SSRS Rectangle with BorderStyle = None...
Try following:
Create an image (the rectangle with rounded corners) in your favourite image drawing program. I did mine in Microsoft Paint
and save it as JPEG.
In SSRS report design, in Report Data pane, right click on Images >> Add Image and point to the image that you created in Step 1. (Untitled, in my case see the fig. below)
In SSRS report design, add a Rectangle from the Toolbox to the design surface and in the Properties Pane:
a) look for the BackgroundImage property Click its + sign. then
b) Enter values for Source as Embedded, BackgroundRepeat as Clip and the Value property , when you click the dropdown for its values, should show you the name of the image that you embedded in Step-2, select this name
Resize your rectangle to fit the shape and add your items to this rectangle.
EDIT:
Regarding the question in the Comment, I don't think that the size of the image rectangle can be increased dynamically. If that's the case then you may need to find some other work-around
HTH

Resources