java.lang.Object
pro.verron.officestamper.preset.Image
This class describes an image which will be inserted into a document.
- Since:
- 1.0.0
- Version:
- ${version}
- Author:
- Joseph Verron, Romster
-
Constructor Summary
ConstructorDescriptionImage
(byte[] imageBytes) Constructor for Image.Constructor for Image.Image
(InputStream in) Constructor for Image.Image
(InputStream in, Integer maxWidth) Constructor for Image. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.use thenewRun(DocxPart, String, String)
method directly to generate a Run with Inline Drawingorg.docx4j.wml.R
Creates a new run with the provided image and associated metadata.
-
Constructor Details
-
Image
Constructor for Image.
- Parameters:
in
- - content of the image as InputStream- Throws:
IOException
- if any.
-
Image
Constructor for Image.
- Parameters:
in
- - content of the image as InputStreammaxWidth
- - max width of the image in twip- Throws:
IOException
- if any.
-
Image
public Image(byte[] imageBytes) Constructor for Image.
- Parameters:
imageBytes
- - content of the image as an array of the bytes
-
Image
Constructor for Image.
- Parameters:
imageBytes
- - content of the image as an array of the bytesmaxWidth
- - max width of the image in twip
-
-
Method Details
-
newRun
Creates a new run with the provided image and associated metadata.TODO: adding the same image twice will put the image twice into the docx-zip file. We should make the second addition of the same image a reference instead.
- Parameters:
document
- The document part where the image will be inserted.filenameHint
- A hint for the filename to be used.altText
- Alternative text for the image.- Returns:
- The created run containing the image.
- Throws:
OfficeStamperException
- If there is an error creating the image part
-
getMaxWidth
Deprecated, for removal: This API element is subject to removal in a future version.use thenewRun(DocxPart, String, String)
method directly to generate a Run with Inline DrawingGetter for the field
maxWidth
.- Returns:
- a
Integer
object
-
getImageBytes
Deprecated, for removal: This API element is subject to removal in a future version.use thenewRun(DocxPart, String, String)
method directly to generate a Run with Inline DrawingGetter for the field
imageBytes
.- Returns:
- an array of
invalid reference
byte
-
newRun(DocxPart, String, String)
method directly to generate a Run with Inline Drawing