Page 1 of 1

Images and Document's WritableWidth

PostPosted: Wed Sep 25, 2013 2:59 am
by RayCast
Hello

Is there a way to know the width of an org.docx4j.openpackaging.parts.WordprocessingML.ImageJpegPart?
In concret, i need to know if an image exceeds the page's WritableWidth.
I'm inserting the images in the document via HTML.

Thanks in advance!!!

Regards, Ray

Re: Images and Document's WritableWidth

PostPosted: Thu Sep 26, 2013 10:55 pm
by jason
Have a look at BinaryPartAbstractImage' createImageInline(String filenameHint, String altText, int id1, int id2, boolean link);

It scales the image based on width, using:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        PageDimensions page = sections.get(sections.size() - 1).getPageDimensions();
        CxCy cxcy = CxCy.scale(imageInfo, page);

 
Parsed in 0.015 seconds, using GeSHi 1.0.8.4

Re: Images and Document's WritableWidth

PostPosted: Sat Sep 28, 2013 1:16 am
by RayCast
Thanks Jason for your quick reply.

Now I'm experimenting another problem. I need to embed the HTML linked images into the Word document.

Thanks in advance for any help.

Cordials Regards, Ray

Re: Images and Document's WritableWidth

PostPosted: Sat Sep 28, 2013 5:07 am
by RayCast
Problem solved

I've converted the HTML sintax to XHTML and then i've inserted the image via XHTMLImporter.convert method.

Now i need to resize the inserted image.
Can you give a tip for solve this?

Thanks again.

Ragards, Ray

Re: Images and Document's WritableWidth

PostPosted: Mon Sep 30, 2013 8:14 am
by jason