Orientation issues in image extraction

Dear Team,

We have problem with page orientation in the image extraction. We have attached the input and current output. Please provide solution for this case.

Input : Blinded Manuscript_3-19-18.zip (192.5 KB)

Current OP : Fig_2.zip (67.5 KB)

@ssvel,

Thanks for your inquiry. You can use PageSetup.Orientation to get or set the orientation of the page. Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "Blinded Manuscript_3-19-18.docx");
int i=1;
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : (Iterable<Shape>) shapes)
{
    Document dstDoc = new Document();
    NodeImporter importer = new NodeImporter(doc, dstDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
    Node newNode = importer.importNode(shape, true);
    dstDoc.getFirstSection().getBody().getFirstParagraph().appendChild(newNode);
    dstDoc.getFirstSection().getPageSetup().setOrientation(shape.getParentParagraph().getParentSection().getPageSetup().getOrientation());
    dstDoc.save(MyDir + "output"+i+".docx");
    i++;
}