We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Unable to convert Word document correctly

Word document converts to 20 pages rather than being a single page document. We are converting to Tiff file format.

We are using GroupDocs.Conversion (the NuGet version 21.8.0.0).
GroupDocs 19.12.1 works.
We also tested it with version 21.9.1, but it did not fix the issue.
For OpenText reference purposes, This relates to issue RF-31555.
I have attach the document.
GroupDocConversionProblem.zip (56.0 KB)

Here are our Option settings:
|Format=tiff|
||Compression=ccitt4|
||GrayScale=True|
||DPI=203x203|
||Height=0|
||Brightness=0|
||Contrast=0|
||Gamma=0|
||StartPage=1|
||PageCount=1000000|
||RotateAngle=0|
||UsePdf=False|

1 Like

@craigjOT

Please note that PageNumber is actually the starting page (from where the conversion will start) and PagesCount is the number of pages to be converted.
For example,

PageNumber = 1,
PagesCount = 2

Using the above options, you will get two TIFF pages converted from that Word document (of course starting from the page 1). You have to change PagesCount to 1 instead of 1000000 in order to get only 1 TIFF as output.

 string outputFolder = @"D:/";
 string outputFileTemplate = Path.Combine(outputFolder, "converted-page-{0}.tiff");
 GroupDocs.Conversion.Contracts.SavePageStream getPageStream = page => new FileStream(string.Format(outputFileTemplate, page), FileMode.Create);
 var opt = new ImageConvertOptions
 {
    PageNumber = 1,
     Format = ImageFileType.Tiff,
     TiffOptions =
     {
        Compression = TiffCompressionMethods.Ccitt4
     },
     Grayscale = true,
     HorizontalResolution = 203,
     VerticalResolution = 203,
     Height = 0,
     Brightness = 0,
     Contrast = 0,
     Gamma = 0, 
     PagesCount = 1,
     RotateAngle = 0,
     UsePdf = false,
     }; 
 using (var converter = new GroupDocs.Conversion.Converter(@"D:/GroupDocConversionProblem.doc"))
 { 
    converter.Convert(getPageStream, opt);
 }

I realize that PageCount is too high. We use that value for all of our GroupDoc conversions and it generally works fine. But even if you put it to a smaller number, the problem is that this should be a 1 to 2 page Word document and the conversion creates 19 to 20 pages of garbage. The tiff output should look like the document if you just open it in MSWord. A single page formatted document.

Continuing the discussion from Unable to convert Word document correctly:

Just a reminder of what was stated in the original bug. This worked in GroupDocs version
19.12.1. It no longer works with the current versions of GroupDocs.

We already tested that (using this code) and got only 1 output document. There are no 19 to 20 pages. Could you please share a screencast/video of this issue using latest API version?

Please let me know what version of GroupDocs.Conversion (NuGet) that you are using.

@craigjOT

We tried 21.9 to reproduce this issue and got only one document as output (using the code shared above).

So I tested with 21.9. Got 19 pages. So I set PageCount to 1 and got one page. The problem is that the conversion is wrong. The 1 pages looks nothing like the original document. That is the point. If you fix the conversion to work correctly, then pagecount could be a higher number. The point is, that the converted document looks nothing like the orignal. Please look at your before and after documents. You will see what I mean. I have attached the comparison of the original to the converted. Comparison.png (168.4 KB)

@craigjOT

This is the output we are getting - output.zip (17.3 KB). And it is much similar to the source file.
Could you please share your development environment details (e.g. OS)? Also share a sample (console) application using that issue could be reproduced at our end.

Thanks… I used some of your sample code and sure enough it converts. We are using some of the overloaded functions. I am trying to create a sample program using the functions that we are using to see if we can duplicate the problem in it. I will get back with you.

Craig…

1 Like

@craigjOT

We’ll look forward to that.

In setting up the test environment, I found that we were not setting up our options correct for word docs. I fixed that and am now getting the correct conversion.
You can close this bug.
Thank-you,
Craig…