image export: pixels to points
This commit is contained in:
parent
3101cf0e42
commit
ba55881830
|
@ -171,11 +171,11 @@ public class WordBuilder {
|
|||
if (readers.hasNext()) {
|
||||
ImageReader reader = readers.next();
|
||||
reader.setInput(iis);
|
||||
int pageWidth = Math.round(mainDocumentPart.getDocument().getBody().getSectPr().getPgSz().getW().intValue() / (float)20);
|
||||
int imageWidth = reader.getWidth(0);
|
||||
int pageWidth = Math.round(mainDocumentPart.getDocument().getBody().getSectPr().getPgSz().getW().intValue() / (float)20); // dxa to points
|
||||
int imageWidth = Math.round(reader.getWidth(0) * (float)0.75); // pixels to points
|
||||
int width = Math.min(imageWidth, pageWidth);
|
||||
int pageHeight = Math.round(mainDocumentPart.getDocument().getBody().getSectPr().getPgSz().getH().intValue() / (float)20);
|
||||
int imageHeight = reader.getHeight(0);
|
||||
int imageHeight = Math.round(reader.getHeight(0) * (float)0.75);
|
||||
int height = Math.min(imageHeight, pageHeight);
|
||||
run.addPicture(image, format, fileName, Units.toEMU(width), Units.toEMU(height));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue