本文整理了Java中com.itextpdf.text.Image.scaleAbsolute()
方法的一些代码示例,展示了Image.scaleAbsolute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.scaleAbsolute()
方法的具体详情如下:
包路径:com.itextpdf.text.Image
类名称:Image
方法名:scaleAbsolute
[英]Scale the image to an absolute width and an absolute height.
[中]将图像缩放到绝对宽度和绝对高度。
代码示例来源:origin: com.itextpdf/itextg
/**
* Scale the image to the dimensions of the rectangle
*
* @param rectangle dimensions to scale the Image
*/
public void scaleAbsolute(final Rectangle rectangle) {
scaleAbsolute(rectangle.getWidth(), rectangle.getHeight());
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Scale the image to the dimensions of the rectangle
*
* @param rectangle dimensions to scale the Image
*/
public void scaleAbsolute(final Rectangle rectangle) {
scaleAbsolute(rectangle.getWidth(), rectangle.getHeight());
}
代码示例来源:origin: org.xhtmlrenderer/flying-saucer-pdf-itext5
public void scale(int width, int height) {
if (width > 0 || height > 0) {
int currentWith = getWidth();
int currentHeight = getHeight();
int targetWidth = width;
int targetHeight = height;
if (targetWidth == -1) {
targetWidth = (int)(currentWith * ((double)targetHeight / currentHeight));
}
if (targetHeight == -1) {
targetHeight = (int)(currentHeight * ((double)targetWidth / currentWith));
}
if (currentWith != targetWidth || currentHeight != targetHeight) {
_image.scaleAbsolute(targetWidth, targetHeight);
}
}
}
代码示例来源:origin: org.xhtmlrenderer/flying-saucer-pdf-itext5
private void scaleToOutputResolution(Image image) {
float factor = _sharedContext.getDotsPerPixel();
if (factor != 1.0f) {
image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor);
}
}
代码示例来源:origin: it.innove/play2-pdf
private void scaleToOutputResolution(Image image) {
float factor = getSharedContext().getDotsPerPixel();
image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor);
}
代码示例来源:origin: com.itextpdf/itextpdf
float heightInPoints = HtmlUtilities.parseLength(height, actualFontSize);
if (widthInPoints > 0 && heightInPoints > 0) {
img.scaleAbsolute(widthInPoints, heightInPoints);
} else if (widthInPoints > 0) {
heightInPoints = img.getHeight() * widthInPoints
/ img.getWidth();
img.scaleAbsolute(widthInPoints, heightInPoints);
} else if (heightInPoints > 0) {
widthInPoints = img.getWidth() * heightInPoints
/ img.getHeight();
img.scaleAbsolute(widthInPoints, heightInPoints);
代码示例来源:origin: com.itextpdf/itextg
float heightInPoints = HtmlUtilities.parseLength(height, actualFontSize);
if (widthInPoints > 0 && heightInPoints > 0) {
img.scaleAbsolute(widthInPoints, heightInPoints);
} else if (widthInPoints > 0) {
heightInPoints = img.getHeight() * widthInPoints
/ img.getWidth();
img.scaleAbsolute(widthInPoints, heightInPoints);
} else if (heightInPoints > 0) {
widthInPoints = img.getWidth() * heightInPoints
/ img.getHeight();
img.scaleAbsolute(widthInPoints, heightInPoints);
代码示例来源:origin: Swati4star/Images-to-PDF
image.scaleToFit(pageWidth, pageHeight);
else
image.scaleAbsolute(pageWidth, pageHeight);
代码示例来源:origin: org.technbolts/gutenberg
public static void adjustOrScaleToFit(Image img, Dimension dim, Rectangle box) {
if (dim == null) {
scaleToFit(img, box);
return;
}
float width = img.getWidth();
switch (dim.unit()) {
case Percent:
width = box.getWidth() * dim.amount() / 100f;
break;
case Px:
width = dim.amount();
break;
}
// W --> w
// H --> h •••> h = w * H / W
float height = width * img.getHeight() / img.getWidth();
img.scaleAbsolute(width, height);
}
代码示例来源:origin: com.itextpdf/itextg
backgroundImage.scaleToFit(background);
} else {
backgroundImage.scaleAbsolute(backgroundImageWidth, backgroundImageHeight);
代码示例来源:origin: com.itextpdf/itextpdf
backgroundImage.scaleToFit(background);
} else {
backgroundImage.scaleAbsolute(backgroundImageWidth, backgroundImageHeight);
代码示例来源:origin: grakic/jfreesteel
image.setBorder(Image.BOX);
image.setBorderWidth(1f);
image.scaleAbsolute(119, 158);
writer.getDirectContent().addImage(image);
代码示例来源:origin: com.itextpdf/itextg
cb.clip();
cb.newPath();
bmp.scaleAbsolute(destWidth * bmp.getWidth() / srcWidth, -destHeight * bmp.getHeight() / srcHeight);
bmp.setAbsolutePosition(xDest - destWidth * xSrc / srcWidth, yDest + destHeight * ySrc / srcHeight - bmp.getScaledHeight());
cb.addImage(bmp);
代码示例来源:origin: com.itextpdf/itextpdf
cb.clip();
cb.newPath();
bmp.scaleAbsolute(destWidth * bmp.getWidth() / srcWidth, -destHeight * bmp.getHeight() / srcHeight);
bmp.setAbsolutePosition(xDest - destWidth * xSrc / srcWidth, yDest + destHeight * ySrc / srcHeight - bmp.getScaledHeight());
cb.addImage(bmp);
内容来源于网络,如有侵权,请联系作者删除!