public abstract class BinaryPartAbstractImage extends BinaryPart
| Modifier and Type | Class and Description |
|---|---|
static class |
BinaryPartAbstractImage.CxCy |
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
contentType, partName, relationships| Constructor and Description |
|---|
BinaryPartAbstractImage(ExternalTarget externalTarget) |
BinaryPartAbstractImage(PartName partName) |
| Modifier and Type | Method and Description |
|---|---|
static void |
convertToPNG(java.io.InputStream is,
java.io.OutputStream os,
int density)
Convert image formats which are not supported by Word (eg EPS, PDF),
into ones which are.
|
static void |
copy2(java.io.InputStream is,
java.io.OutputStream os) |
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2)
Deprecated.
|
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2,
boolean link)
Create a
|
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2,
boolean link,
int maxWidth) |
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2,
long cx)
Deprecated.
|
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2,
long cx,
boolean link)
Create a
|
Inline |
createImageInline(java.lang.String filenameHint,
java.lang.String altText,
long id1,
int id2,
long cx,
long cy,
boolean link)
Create a
|
static java.lang.String |
createImageName(Base sourcePart,
java.lang.String proposedRelId,
java.lang.String ext)
Deprecated.
|
static java.lang.String |
createImageName(OpcPackage opcPackage,
Base sourcePart,
java.lang.String proposedRelId,
java.lang.String ext) |
static BinaryPartAbstractImage |
createImagePart(OpcPackage opcPackage,
Part sourcePart,
byte[] bytes)
Create an image part from the provided byte array, attach it to the source part
(eg the main document part, a header part etc), and return it.
|
static BinaryPartAbstractImage |
createImagePart(OpcPackage opcPackage,
Part sourcePart,
byte[] bytes,
java.lang.String mime)
Create an image part from the provided byte array, attach it to the source part
(eg the main document part, a header part etc), and return it.
|
static BinaryPartAbstractImage |
createImagePart(OpcPackage opcPackage,
Part sourcePart,
byte[] bytes,
java.lang.String mime,
java.lang.String ext)
Deprecated.
|
static BinaryPartAbstractImage |
createImagePart(OpcPackage opcPackage,
Part sourcePart,
java.io.File imageFile)
Create an image part from the provided filePath image, attach it to the source part
(eg the main document part, a header part etc), and return it.
|
static BinaryPartAbstractImage |
createImagePart(WordprocessingMLPackage wordMLPackage,
byte[] bytes)
Create an image part from the provided byte array, attach it to the
docx main document part, and return it.
|
static BinaryPartAbstractImage |
createImagePart(WordprocessingMLPackage wordMLPackage,
java.io.File imageFile)
Possibility to put directly an image filePath instead of giving an image byte array
|
static BinaryPartAbstractImage |
createLinkedImagePart(OpcPackage opcPackage,
Part sourcePart,
java.net.URL url)
Create a linked image part, and attach it as a rel of the specified source part
(eg a header part).
|
static BinaryPartAbstractImage |
createLinkedImagePart(WordprocessingMLPackage wordMLPackage,
java.net.URL fileurl)
Create a linked image part, and attach it as a rel of the docx main document part
|
static void |
displayImageInfo(org.apache.xmlgraphics.image.loader.ImageInfo info) |
static byte[] |
getImage(WordprocessingMLPackage wmlPkg,
Graphic graphic)
Convenience method, given a Graphic in a document,
to get the byte[] representing
the associated image
The method assumes your image is in the main document part (as opposed to a header/footer etc)
|
org.apache.xmlgraphics.image.loader.ImageInfo |
getImageInfo()
Deprecated.
|
static org.apache.xmlgraphics.image.loader.ImageInfo |
getImageInfo(java.net.URL url) |
protected static org.apache.xmlgraphics.image.loader.ImageManager |
getImageManager() |
Relationship |
getRelLast() |
java.util.List<Relationship> |
getRels() |
static void |
main(java.lang.String[] args) |
static void |
setDensity(int density)
Set the resolution at which a PDF or EPS is converted
to PNG.
|
void |
setImageInfo(org.apache.xmlgraphics.image.loader.ImageInfo imageInfo)
Deprecated.
|
getBuffer, getBytes, getExternalTarget, isContentEqual, isLoaded, setBinaryData, setBinaryData, setBinaryData, writeDataToOutputStreamgetContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersionaddTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserDatapublic BinaryPartAbstractImage(PartName partName) throws InvalidFormatException
InvalidFormatExceptionpublic BinaryPartAbstractImage(ExternalTarget externalTarget)
@Deprecated public org.apache.xmlgraphics.image.loader.ImageInfo getImageInfo()
@Deprecated public void setImageInfo(org.apache.xmlgraphics.image.loader.ImageInfo imageInfo)
public java.util.List<Relationship> getRels()
public Relationship getRelLast()
public static void setDensity(int density)
density - protected static org.apache.xmlgraphics.image.loader.ImageManager getImageManager()
public static BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage, byte[] bytes) throws java.lang.Exception
wordMLPackage - sourcePart - bytes - java.lang.Exceptionpublic static BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage, java.io.File imageFile) throws java.lang.Exception
wordMLPackage - imageFile - java.lang.Exception@Deprecated public static java.lang.String createImageName(Base sourcePart, java.lang.String proposedRelId, java.lang.String ext)
sourcePart - proposedRelId - ext - public static java.lang.String createImageName(OpcPackage opcPackage, Base sourcePart, java.lang.String proposedRelId, java.lang.String ext)
opcPackage - sourcePart - proposedRelId - ext - extension eg pngpublic static BinaryPartAbstractImage createImagePart(OpcPackage opcPackage, Part sourcePart, byte[] bytes) throws java.lang.Exception
opcPackage - sourcePart - bytes - java.lang.Exception@Deprecated public static BinaryPartAbstractImage createImagePart(OpcPackage opcPackage, Part sourcePart, byte[] bytes, java.lang.String mime, java.lang.String ext) throws java.lang.Exception
opcPackage - sourcePart - bytes - mime - MIME type eg image/pngext - filename extension eg pngjava.lang.Exceptionpublic static BinaryPartAbstractImage createImagePart(OpcPackage opcPackage, Part sourcePart, byte[] bytes, java.lang.String mime) throws java.lang.Exception
opcPackage - sourcePart - bytes - mime - MIME type eg image/pngjava.lang.Exceptionpublic static BinaryPartAbstractImage createImagePart(OpcPackage opcPackage, Part sourcePart, java.io.File imageFile) throws java.lang.Exception
opcPackage - sourcePart - filePath - java.lang.Exceptionpublic static BinaryPartAbstractImage createLinkedImagePart(WordprocessingMLPackage wordMLPackage, java.net.URL fileurl) throws java.lang.Exception
wordMLPackage - fileurl - java.lang.Exceptionpublic static BinaryPartAbstractImage createLinkedImagePart(OpcPackage opcPackage, Part sourcePart, java.net.URL url) throws java.lang.Exception
wordMLPackage - sourcePart - url - java.lang.Exception@Deprecated public Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2) throws java.lang.Exception
filenameHint - Any text, for example the original filenamealtText - Like HTML's alt textid1 - An id unique in the documentid2 - Another id unique in the document
None of these things seem to be exposed in Word 2007's
user interface, but Word won't open the document if
any of the attributes these go in (except @ desc) aren't present!java.lang.Exceptionpublic Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2, boolean link) throws java.lang.Exception
filenameHint - Any text, for example the original filenamealtText - Like HTML's alt textid1 - An id unique in the documentid2 - Another id unique in the documentlink - true if this is to be linked not embedded
None of these things seem to be exposed in Word 2007's
user interface, but Word won't open the document if
any of the attributes these go in (except @ desc) aren't present!java.lang.Exceptionpublic Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2, boolean link, int maxWidth) throws java.lang.Exception
filenameHint - altText - id1 - id2 - link - maxWidth - java.lang.Exception@Deprecated public Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2, long cx) throws java.lang.Exception
filenameHint - Any text, for example the original filenamealtText - Like HTML's alt textid1 - An id unique in the documentid2 - Another id unique in the documentcx - Image width in twip
None of these things seem to be exposed in Word 2007's
user interface, but Word won't open the document if
any of the attributes these go in (except @ desc) aren't present!java.lang.Exceptionpublic Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2, long cx, boolean link) throws java.lang.Exception
filenameHint - Any text, for example the original filenamealtText - Like HTML's alt textid1 - An id unique in the documentid2 - Another id unique in the documentcx - Image width in twiplink - true if this is to be linked not embedded
None of these things seem to be exposed in Word 2007's
user interface, but Word won't open the document if
any of the attributes these go in (except @ desc) aren't present!java.lang.Exceptionpublic Inline createImageInline(java.lang.String filenameHint, java.lang.String altText, long id1, int id2, long cx, long cy, boolean link) throws java.lang.Exception
filenameHint - Any text, for example the original filenamealtText - Like HTML's alt textid1 - An id unique in the documentid2 - Another id unique in the document None of these things seem to
be exposed in Word 2007's user interface, but Word won't open
the document if any of the attributes these go in (except @ desc) aren't
present!cx - Image width in EMUcy - Image height in EMUlink - true if this is to be linked not embeddedjava.lang.Exceptionpublic static org.apache.xmlgraphics.image.loader.ImageInfo getImageInfo(java.net.URL url)
throws java.lang.Exception
java.lang.Exceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionpublic static void displayImageInfo(org.apache.xmlgraphics.image.loader.ImageInfo info)
public static byte[] getImage(WordprocessingMLPackage wmlPkg, Graphic graphic)
wmlPkg - graphic - public static void convertToPNG(java.io.InputStream is,
java.io.OutputStream os,
int density)
throws java.io.IOException,
java.lang.InterruptedException
is - os - density - PixelsPerInchjava.io.IOExceptionjava.lang.InterruptedExceptionpublic static void copy2(java.io.InputStream is,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionCopyright © 2007–2023. All rights reserved.