Single Page Tiff from Mutiple page document

Hello,
I have a multiple page document which I load to aspose.words object. When I try to save this document to Image it saves all the pages in one Tiff and makes the mutli page tiff file which works fine.
I need to know if there is any property or method that can save seperate individual tiff images for each document page. For example if abc.doc has 10 pages in it, I wish to save 10 tiff images per page. Is this possible thur aspose.words?
Any sample available?
Thanks,
Vinay Hattarki

Hi

Thanks for your request. Yes, of course you can do that using Aspose.Words. You should use SaveToImage method. Please follow the link to learn more:
https://docs.aspose.com/words/net/convert-a-document-to-an-image/
See also following code for instance:

Document doc = new Document("in.doc");
ImageOptions opt = new ImageOptions();
opt.TiffCompression = TiffCompression.Lzw;
for (int i = 0; i < doc.PageCount; i++)
    doc.SaveToImage(i, 1, " out_" + i.ToString() + ".tif", opt);

Best regards.

Thanks I did work out that but it seems there is a difference in Tiff images.
I have attached document which has 3 pages in it. I did save Tiff out of that and which comes as 4 different images. I am not sure why? It seems like margins are not carried over properly when the doc is loaded in the object.
Is there any way to be for sure that its going to create same no of images and with no margin issue.
Please look at the attached document and try loading it to object of Words. It gives page count as 4 even though document is of 3 pages. Hence it creates 4 images which is incorrect.
Thanks

Hi

Thank you for additional information. I converted your document to TIF and got 3 images (I attached my results). This might be a problem with fonts. Here is list of fonts used in your document:

Shruti
Lucida Calligraphy
Arial Narrow
Arial Rounded MT Bold
Tahoma
Times New Roman

Please make sure that all these fonts are installed on PC where you perform conversion. Also please make sure you are using the latest version of Aspose.Words (6.2.0).
Best regards.

Hello,
From the font end I see everything looks good. I was able to get the data correct but it seems the issue is because of Header and Footer which is not being carried by Aspose Object similar to MSWord.
Please look at attached two documents.
4PagesCorrect.Doc has 4 pages with data correct as needed. I tried getting same document to Aspose Object and saved it and result of that is ConvertedToAspose.doc.(5 pages)
I see difference in pages and last row is being carried over to next page. I did realize that when I open the ConvertedToAspose.doc in MSWord and just click on View Menu–>Header and Footer and without doing any changes just close Header and Footer toolbar that fixes the problem and everything shows correct as per 4PagesCorrect.Doc.
I am not sure why Aspose object is not creating the document in same fashion as MSWord with Header and Footer being as it is.
I intent to save images from this document which should be correct. As the document is incorrect I cannot get the images in correct format.
Appreciate help to resolve the issue.
Thanks,
Vinay Hattarki

Hi

Thank you for additional information. I see that in the second document header was added. Most likely, you have added it through the code. Could you please provide me your code? I will try to reproduce the problem on my side and provide you more information.
In addition, there are 5 pages in both documents.
Best regards.

Here is the code…I am really not manupulating the document nor I am changing anything at runtime.
I am just saving the Word.Document object with file XYZ and try open same XYZ and Save as with Aspose.

Private mwdDocument As Word.Document
...just open the document in mwdDocument and save it....
mwdDocument.SaveAs(lsDocName.ToString)....**The document named (4PagesCorrect.doc) was created by this method and it is 4 pages if you open from earlier replies in this post.**
If File.Exists(lsDocName) = True Then
 Dim lobjDocument As Aspose.Words.Document
 lobjDocument = Nothing
 lobjDocument = New Aspose.Words.Document(lsDocName, Aspose.Words.LoadFormat.Doc, "")
 lobjDocument.Save("c:\convertedBeforeUpdate.doc").......

The document named (ConvertedToAspose.doc) was created by this method and it is 5 pages if you open from earlier replies in this post.

End If

Hi

Thank you for additional information. I cannot reproduce the problem on my side. Here is my code, I used for testing.

// Open docuemnt
Document doc = new Document(@"Test217\4PagesCorrect.doc");
// Save document
doc.Save(@"Test217\out.doc");

The output document is exactly the same as input document (see attached files).
I am sure that you do something with document in your code, if compare 4PagesCorrect.doc and ConvertedToAspose.doc you have attached earlier, you will see that these document have different footers. Therefore, I suppose you do something with document through the code, or output document was produced from another document.
Best regards.

Hello,
Here is the new sample explaining this issue again. I have two attachments in zip ( Attachment 2Temp.Doc and AsposeMultipage.Tif)
I am just trying to get this 11page Doc to 11 multipage TIF. Here are the problems and would like to know why aspose is doing this.
Issue # 1. On Page one Aspose is missing single line on third row, compare same with Attachment Temp.Doc .
Issue # 2. New Iberia, Lousiana is aligned to “Center” in actual word document it is “Right” aligned.
Issue # 3.If you look closely I am using form fields in the 11 page document provided. I see its converting “Empty” form fields data to 5 squares in Tif image. But where data is available it keeps the data correct in tiff images. When data is empty in doc it just coverts it to be squares.
Issue # 4. If you navigate to Page 4 in document and compare page 4 on Tiff you will see that Tiff image has extra two lines at the end compared to DOC. I am not sure why aspose is getting data from next page # 5 and processing it in Page # 4.
These issues are creating problem for me to finalize the image save as it is in document. Please let me know if you need any additional information. Try compare both the documents closely and you will see the actual difference. I am really not doing any processing on the document it just simple saved document from MSWord and trying to Convert to Multipage TIF thru Aspose.
Thanks,
Vinay Hattarki

More Updates…
On top of these issues, AsposeSaved Multipage.Tif is not carring the left and Right margins as per the document. I have my DOC file provided in earlier post with mirror margin and it seems that Aspose object is dropping the margins when it saves the multipage tif. I have tried it with single page saving tif and it results with same issues.
Thanks,
Vinay Hattarki.

Additional Information…
I did try to save the Aspose object’s document before creating tif out of it and it did come same as Original Document. This proves that as far as Document saving is concered it works just fine with Aspose. The aspose saved .DOC also carried the formatting and Mirror margin as required.
But when same original doc is tried to be saved as multipage tif or individual tif it is not working as per expectation.
Hope this helps
Thanks,
Vinay Hattarki

Hi

Thank you for additional information.
The latest version of Aspose.Words (6.2.0) throws NullReferenceException during rendering the document you have attached. I logged this problem to our defect database as issue #7769.

  1. and 2. I removed all content from the original document, except “New Iberia, Lousiana”, managed to reproduce the problem with alignment and with missed line. It seems to be the known issue #7665 in our defect database. The reason of the problem is SmartTags inside paragraph. As a workaround, you can try to remove all SmartTags from the document.
  2. Cannot reproduce the problem with form fields upon converting document to TIF, however, I managed to reproduce the same problem upon converting to PDF and created new issue #7770 in our defect database.
  3. I think this issue is related to #7665. Aspose.Words ignores paragraph break if the paragraph contains SmarTtag. So some paragraph breaks was ignored on page 4.
  4. Regarding mirror margins, we already discussed this issue in the following forum thread.
    This is the issue #7494 in our defect database.

In addition, I suppose you are using some old version of Aspose.Words for testing, maybe 6.0.1 or 6.1.0. Please use the latest version for testing.
Best regards

Hi,
Is there any timeline to get these problems fixed? Accurate Image conversion is important need in the development I am doing with Aspose.
Also on Issue # 3 when you said you cannot reproduce the issue with TIF but you were able to with PDF. Did you see my TIF attachment which had blank squares? On the other end this could be again related to Aspose.Words (6.2.0) NullReferenceException throw, as it shows blank squares only when the form field data is empty. When formfield has data entered that is carried over properly to TIF image.
I have just upgraded to 6.1.0, will try getting the newer version soon. Please keep posted on the fix timelines.
Thanks,
Vinay Hattarki

Hi

Thanks for your request. Unfortunately, I cannot provide you any reliable time frame regarding these issue at the moment.
Regarding issue #3, I tried to convert simple document with empty form field to TIF and there is no problems. However, when I convert document with empty form field to PDF, I see the same problem as in your TIF.
Please use the latest version (6.2.0) for testing.
https://releases.aspose.com/words/net
Best regards.

The issues you have found earlier (filed as 7769) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(20)

The issues you have found earlier (filed as 7494;7770) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as 7665) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)