Doc to Pdf conversion - 2 pages with Aspose and 1 with Word

Hi all,

I have a question,
I’m converting a DOC file with Aspose and with Word automation.
I’m comparing between the two of them and they are not match.
The fonts differences is one thing, but the result of that (or of something else maybe) is that I have an extra page.
This is very critical and could waste papers for our clients.

I must have a solution for this ASAP because we just on to this and we are scheduled to release a new version soon.

Attached are the DOC file example before conversion, and two PDF files after conversion, one is Aspose conversion and the other made with Word automation (2007).

At first, I assumed it was because of the big red line of the evaluation, but I don’t have it anymore (got a licence)

I wrote the following c# code to convert the document:

internal byte[] ConvertRightNowAspose(byte[] aDocument, SaveFormat saveFormat)
{
    Aspose.Words.Document doc = new Aspose.Words.Document(new MemoryStream(aDocument));
    doc.PageColor = Color.White; // doc files are saved with red background on the server, changing to white anyway
    MemoryStream firstStream = new MemoryStream();
    doc.Save(firstStream, SaveFormat.Pdf);
    return firstStream.GetBuffer();
}

Thanks in advanced,
Lidan Hackmon.

Hi

Thank you for considering Aspose.Words. When I open your original document on my side it has the same layout as PDF produced by Aspose.Words. In addition, as I can see MS Word uses ‘Nyala’ font in PDF, but I cannot see this font in the document’s font table. Should this font actually be used in the document? If so, please attach it here for testing.
Best regards,

Hi,
Thank you very much for your response.

Shouldn’t it be the same anyway since they both uses the same fonts directory?

Attached is the font you requested.

Please let me know if you need more information

Thanks again,
Lidan

Hi

Thank you for additional information. It is strange, this font is not actually used in the original document. But PDF document you attached contains this font. When you open your document in MS Word, how many pages is there? I see two pages, just as in PDF produced by Aspose.Words.
Also, I tried convert your document to PDF using MS Word and there is still 2 pages.
Best regards,

Hi,
Thank you for you answer.
I tried to convert this DOC file manually on the server to PDF through word and it still got 2 pages.
I’ll attach the code of the server that converts through Word automation, maybe you’ll have an idea if the code is related to that.

object oFilename = aFileName;
mDocument = Instance.Documents.Open(ref oFilename, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
mDocument.ActiveWindow.View.Type = WdViewType.wdNormalView;
int argb = Color.FromKnownColor(KnownColor.White).ToArgb();
int backcolor = Microsoft.VisualBasic.Information.RGB((Color.FromArgb(argb).R), (Color.FromArgb(argb).G), (Color.FromArgb(argb).B));
mDocument.Background.Fill.ForeColor.RGB = backcolor;
mDocument.Background.Fill.Solid();
SaveAs(aFileName.Replace(".doc", fileExtension), format);
mDocument.Close(ref oFalse, ref oMissing, ref oMissing);
mDocument = null;
if (ConversionFinished != null) ConversionFinished(aFileName.Replace(".doc", ".pdf"));
File.Delete(aFileName);

Thanks,
Lidan

Hi Ladan,

Thanks you for additional information. PDF produced by Aspose.Words has the same layout as the original document. So there is no problem with Aspose.Words. When you open your document in MS Word, how many pages is there? On my side I see 2 pages, just as in PDF produced by Aspose.Words.
Best regards,

Hi Alexey,
Thank you for your quick answers.

I also see 2 pages.

My concern is that my company knows that Word is “shrinking” this document when converting to PDF and Aspose isn’t, we are looking for a solution.
We want Aspose to be the exact same conversion as Word.
From the other hand, Aspose did it exactly as the DOC file was, so I’m not sure if this is solvable.

About the fonts,
Do you have any idea why there are differences?

Lidan

Hi Lidan,

Thank you for additional information. The problem with conversion to PDF using Word Automation might occur because it cannot read (or find) fonts used in the original document. That is why most likely Word Automation try to find an alternative font and uses Nyala font.
By the way, do you convert document to PDF using Aspose.Words and Word Automation in the same environment? If you convert the document to PDF in different environments there might be difference because different set of fonts is installed.
Best regard,

Hi,
Thanks for you reply.

Yes, they were exported on the same server. I’ve created a temporary configuration that determines which conversion method to use (Aspose or Word Automation) to make is easy compare between the two of them.

So basically you are saying this is not an Aspose bug and its probably Word Automation bug.

I’ll pass this information to my managers.

Thanks for you help Alexey

Hi

Yes, I think this might be a bug in Ms Word PDF converter. I think the output PDF should look the same as the original document looks in MS Word.
By the way, PDF produce by MS Word on my side looks the same as PDF produced by Aspose.Words. So there might be something wrong on your side.
Best regards,

Hi,
You mean with my PDF reader? which one do you use? I use Acrobat Reader 8.3

Hi

Thanks for your inquiry. You reader is ok. I also see one page in the PDF generated on your side using Word automation. I mean maybe there is something wrong with your code that used Word automation to convert the document to PDF.
Best regards,

Hi,
Maybe the Word Automation code is the real problem here.
But on the other hand, its right here and it looks pretty straight forward without anything special.

I’ll check more documents to be sure.

Thank you

Hi

Thank you for additional information. Have you tried converting your document in MS Word? MS Word should give you the same result as your code that uses Word Automation.
Best regards.

Yes,
Sorry for not mentioning it, I still got 2 pages.