i'm trying to append picture to first page of a document.
how can I place the image on the entire page width? with no margin on the right..
please assist to remove the right margin from the picture, but NOT from the entire page
(notice that the text below to the picture should have margins).
- Code: Select all
DocPicture image = section.addParagraph().appendPicture(imageSection.getImage());
image.setTextWrappingStyle(TextWrappingStyle.Square);
image.setHorizontalPosition(0f);
image.setHorizontalOrigin(HorizontalOrigin.Page);
image.setHorizontalAlignment(ShapeHorizontalAlignment.Left);
image.setVerticalPosition(0f);
image.setVerticalOrigin(VerticalOrigin.Page);
image.setVerticalAlignment(ShapeVerticalAlignment.Top);
image.setVerticalAlignment(ShapeVerticalAlignment.Bottom);
float boundWidth = section.getPageSetup().getMargins().getLeft()
+ section.getPageSetup().getMargins().getRight()
+ section.getPageSetup().getClientWidth();
float boundHeight = (float) section.getPageSetup().getPageSize().getHeight();
if (picture.getWidth() != boundWidth) {
newWidth = boundWidth;
newHeight = (newWidth * picture.getHeight()) / picture.getWidth();
}
image.setWidth(newWidth);
image.setHeight(newHeight);
thank you
Adi