Docx becomes one page and image is truncated

Last post 01-11-2012, 5:42 AM by awais.hafeez. 3 replies.
Sort Posts: Previous Next
  •  01-10-2012, 3:56 AM 354078

    Docx becomes one page and image is truncated .NET

    Attachment: Present (inaccessible)
    I am using Aspose.Words 10.8 (.Net 4.0 version) to create a tiff document from a docx (see attachments). The docx has two pages with one image on each page. The resulting tiff has only one page with the second image truncated. In debug mode I can see that the created Aspse.Words-Dokument object only has one page directly after I read the docx-file with the Aspose.Words library.

    Can someone help me with this?
    Filed under: .docx;.Net 3.5;TIFF
     
  •  01-10-2012, 5:15 AM 354093 in reply to 354078

    Re: Docx becomes one page and image is truncated

    Hi,

    Thanks for your inquiry. While using the latest version of Aspose.Words i.e. 10.8.0, I managed to reproduce this issue on my side. Your request has been linked to the appropriate issues and you will be notified as soon as these are resolved. Sorry for inconvenience.

    However, you can use the following code snippet as a temporary work around:

    Document docx = new Document(@"c:\test\Anker.docx");

    MemoryStream docStream = new MemoryStream();
    docx.Save(docStream, SaveFormat.Doc);

    Document doc = new Document(docStream);

    NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
    foreach (Shape shape in shapes)
    {
        shape.WrapType = WrapType.Inline;
    }

    doc.Save(@"c:\test\Anker_out.tiff");

    I hope, this will help.

    Best Regards,

    Awais Hafeez
    Support Developer
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  01-11-2012, 4:52 AM 354348 in reply to 354093

    Re: Docx becomes one page and image is truncated

    Attachment: Present (inaccessible)
    Thank you very much for reviewing this issue.

    Unfortunately, the proposed workaround does not work properly. It messes up the anchor points of images. In the attached document, for example, the achor point of the image is at the very bottom of the page. It seems like the proposed workaround moves the anchor of the image off the page and therefore the image gets deleted.

    Is there a side-effect-free workaround available?
     
  •  01-11-2012, 5:42 AM 354357 in reply to 354348

    Re: Docx becomes one page and image is truncated

    Hi Peter,

    Thanks for your inquiry. First of all, please note that the work around was meant for Anker.docx document and was not the actual solution. Secondly, in this case, I would suggest you use the proper way of saving DOCX to TIFF format as follows:

    Document doc = new Document(@"c:\temp\TestAnkerUnten.docx");
    doc.Save(@"c:\temp\out.tiff");

    I hope, this will help.

    Best Regards,

    Awais Hafeez
    Support Developer
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
View as RSS news feed in XML