I attached a word document that is being transformed into a pdf. Works almost perfectly with version Aspose.Word 2.4.1.0 and Aspose.Pdf 2.4.2.0
please check the pdf document and notice that at many places, the text is in bold where it shouldn’t and at many places, there is no space between words where it should! At some place, words overlap too. Check page 3, second paragraph for some example of what I mean.
Why is that? It’s really important and I would appreciate a quick response on the above while what’s below is less important for now!
Also, yesterday, I tried to migrate to version 3 of Aspose.Word, but no luck, the document won’t even save as xml for Aspose.Pdf.
Thank you for your support, keep up the great work!
I’ve attached the resulting PDF made with Aspose.Word 3.0. As you can see, the issues seem to disappear. So please give a detailed explanation of the problem with migrating to v3: post the code you are using for the conversion, describe what exceptions are thrown (if any) and so on. Using the latest version of the component would allow you to avoid many issues including one being discussed thus we are interested to help you to migrate, too.
I just updated again to 3.0 (Word) and 2.4.2 (Pdf) and still not working!
The error comes from this line of code:
doc.Save(xmlFileName, Aspose.Word.SaveFormat.FormatAsposePdf);
and here is the error:
Server Error in ‘/INTRANET’ Application.
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
The only thing I changed when using v3 is the AppendDoc function
private void AppendDoc(Aspose.Word.Document dstDoc, Aspose.Word.Document srcDoc)
{
for (int i = 0; i < srcDoc.Sections.Count; i++)
{
Aspose.Word.Section sourceSection = srcDoc.Sections;
Aspose.Word.Section newSection = (Aspose.Word.Section)dstDoc.ImportNode(sourceSection, true);
dstDoc.Sections.Add(newSection);
}
while (srcDoc.Sections.Count > 0)
{
Aspose.Word.Section section = srcDoc.Sections[0];
// The section must first be removed before it can be inserted into a document.
srcDoc.Sections.RemoveAt(0);
dstDoc.Sections.Add(section);
}
}
The issue is definitely related to font styles. If you clear font formatting of the document, the issue disappears. Now I’m trying to figure what style causes the problem. Also, I think we will fix the issue asap.
After further investigation it proved that the styles are okay but the issue was caused by difference of font size of {PAGE}, {NUMPAGES}, and the text of the paras that contain these fields. Sounds strange, however, making footer font size similar everywhere helps. Please see attached.
I just fixed the font size of page and numpages to be the same. In fact, the whole footer is now the same font / fontsize and still get the same error.
In this version of the document the hyperlinks whose formatting was similar to the paras’ one caused the error. So in the meantime (until the hotfix is out) I’ve cleared the hyperlink formatting. Please see attached and report if it works.
1- how do you turh the formatting off?
2- how do you find that the error is at that precise place? is it possible for me to find those kind of error? this would be helpful until the fix is release!
I cleared the formatting of the whole paras using the MS Word Formatting toolbar (Clear Format command) and then made it Arial 10pt centered again.
That’s why it took a while. The problem is that error is being occured in one place of the code but can be caused by different things in the document, so I’m afraid such the places could be too custom to find them. The hotfix is the real solution and we’ll try to release it asap.
It surely works for me with Aspose.Word 3.0.1, I’ve double checked it.