Page 1 of 1

equations and signatures

PostPosted: Tue Jul 09, 2013 6:53 pm
by eltayeb
Hi All ,

i want to ask about 2 items in docx is how to extract equations and signatures

Thanks in advance

Re: equations and signatures

PostPosted: Wed Jul 10, 2013 5:58 pm
by eltayeb
Hi,

i have org.docx4j.wml.Pict in the document but i cant extract the image it points to

here's the object in document.xml
Code: Select all
- <w:pict>
- <v:shape id="_x0000_i1026" type="#_x0000_t75" alt="Microsoft Office Signature Line..." style="width:192pt;height:96pt">
  <v:imagedata r:id="rId6" o:title="" />
  <o:lock v:ext="edit" ungrouping="t" rotation="t" cropping="t" verticies="t" text="t" grouping="t" />
  <o:signatureline v:ext="edit" id="{3001DB6C-35C4-4FE9-8563-9238D648856B}" provid="{00000000-0000-0000-0000-000000000000}" o:suggestedsigner="samar hamdy" o:suggestedsigner2="QA engineer" o:suggestedsigneremail="samar_hamdy@mentor.com" issignatureline="t" />
  </v:shape>
  </w:pict>



so i want to extract image as array of bytes like when using BinaryPartAbstractImage.getImage()

Re: equations and signatures

PostPosted: Wed Jul 10, 2013 7:26 pm
by jason
What does rId6 contain?

Unzip the file manually to have a look, or upload it to webapp.docx4java.org

Re: equations and signatures

PostPosted: Wed Jul 10, 2013 7:52 pm
by eltayeb
i aleardy use webapp.docx4java.org and get that rId6 contains MetafileEmfPart and get path of image /word/media/image1.emf

so now i want to convert this message to arrays of bytes
and also asking is there's method to get the object related to rId6 relation directly

thanks in advance

Re: equations and signatures

PostPosted: Sun Jul 14, 2013 7:25 pm
by eltayeb
for Archiving

i used this code for getting image and convert it to bytes


Code: Select all
MetafileEmfPart image = (MetafileEmfPart) part ;
            byte[] imageBytes = new byte[image.getBuffer().limit()];
            for(int i = 0 ; i < imageBytes.length ; i++){
               imageBytes[i] = image.getBuffer().get(i);
            }

Re: equations and signatures

PostPosted: Mon Jul 15, 2013 7:43 pm
by jason
You can remove your for loop and use instead:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        image.getBuffer().get(imageBytes );            
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4