Error Converting Doc to PDF When doc contains bullets

I am using Aspose.Words 6.3.0.0 Runtime Version v2.0.50727. When attempting to convert the attached document I get the following error:

System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.\_\_Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt32()
at ؄.ଔ.ଗ()
at 㻦.䀂..ctor(ଔ reader)
at 㻦.㾧.㿄()
at 㻦.㾧.޻(Stream ӹ)
at 㻦.㾧.޻(String ӷ)
at 㻦.㾧.㾾(String ⯡)
at 㻦.㾧.㼜(String ⯡, FontStyle ए, Boolean 㾻)
at 㻦.㾧.ে(String ⯡, FontStyle ए, Boolean 㾻)
at 㹌.㻔..ctor(㺂 context, String familyName, FontStyle requestedStyle)
at 㹌.㼧..ctor(㺂 context, String familyName, FontStyle requestedStyle)
at 㹌.㻔.㻡(㺂 ౅, String ⯡, FontStyle 㻢, Boolean 㻣)
at 㹌.㼕.ে(String ⯡, FontStyle ए, Boolean 㻣)
at 㹌.䄜.䄤(㝈 䄆)
at 㹌.䃿.㰀(㝈 䄆)
at 㹌.䇩.VisitGlyphs(㝈 glyphs)
at 㝁.㝈.Accept(㝄 visitor)
at 㝁.㝂.Accept(㝄 visitor)
at 㝁.㞕.Accept(㝄 visitor)
at 㝁.㝂.Accept(㝄 visitor)
at 㝁.㞕.Accept(㝄 visitor)
at 㝁.㝂.Accept(㝄 visitor)
at 㝁.㞕.Accept(㝄 visitor)
at 㝁.㝂.Accept(㝄 visitor)
at 㝁.㝅.Accept(㝄 visitor)
at 㹌.䇩.㫦(㝀 Ԃ)
at Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, Stream stream, PdfOptions options)
at CGG.eB\_Powertools.QRR.Logic.SaveDocAsPdf(MemoryStream Orig\_File) 

If I remove the bullets in the document it works fine, if l leave the bullet in it fails. Please note this being done using a memory stream with the code shown below:

private System.IO.MemoryStream SaveDocAsPdf(System.IO.MemoryStream Orig\_File)
{
    System.IO.MemoryStream stream;
    Aspose.Words.License license\_Word;
    Aspose.Words.Document doc;
    try
    {
        //license
        license_Word = new Aspose.Words.License();
        license_Word.SetLicense("Aspose.Total.lic");
        //end license 
        stream = new System.IO.MemoryStream();
        //Load the document so it can be saved
        Orig_File.Position = 0;
        doc = new Aspose.Words.Document(Orig_File);
        doc.SaveToPdf(0, doc.PageCount, stream, null);
        CGG.eB_Powertools.QRR.MemoryManagement.FlushMemory();
        return stream;
    }
    catch (Exception ex)
    {
        throw new ApplicationException(null, ex);
    }
    finally
    {
        stream = null;
        license_Word = null;
        doc = null;
    }
}

Hi

Thanks for your request. I cannot reproduce the problem on my side. Could you please create simple application that will allow me to reproduce the problem? I used the following code for testing:

Document doc = new Document(@"Test095\Copy+of+Orig\_NO\_2-16-09.doc");
doc.SaveToPdf(0, doc.PageCount, @"Test095\out.pdf", null);

Best regards.

I believe I have given you all the code you should need to reproduce this problem but you need to use a stream vs opening the file directely from the file path.

Hi Robert,

Thank you for additional information. There is no difference open document from file or from stream. I tried using both approaches, however still cannot reproduce the problem on my side. Here is code I used for testing:

//Open document
Stream docStrm = new FileStream(@"Test095\Copy+of+Orig\_NO\_2-16-09.doc", FileMode.Open);
//Create Aspose.Words.Document object from stream
Document doc = new Document(docStrm);
//Create memory stream and save the document to PDF
MemoryStream pdfStream = new MemoryStream();
doc.SaveToPdf(0, doc.PageCount, pdfStream, null);

Maybe you have attached a wrong document. Please try saving this document to PDF on your side using code I provided in my previous answer – just open the document as save it in PDF.

Also, the problem can be caused by fonts, however I cannot see that you are using some special fonts in your document. Only standard Times New Roman, Arial and Tahoma fonts are using in the document. Maybe there is difference in versions of these fonts. Could you please attach these fonts here for testing.

Best regards.

Sorry for the delay in responding, I was on vacation last week.

I have downloaded the file I originally posted to make sure I uploaded the correct file.� Using that file I do get the error in the following 3 scenarios

  1. Using my original code
  2. Using your code
  3. Modifiying your code to open my file using file stream, convert to memory stream then pass to my method originally posted.

Perhaps fonts are the problem, they are attached.

Hi

Thank you for additional information. Arial and Times New Roman fonts are the same on my side, but Tahoma is different. I cannot reinstall this font on my side because this is system font and OS does not allow me to remove it. What OS are you using?

Please try doing the following: create simple document with text, set font to Tahoma and try to convert this document to PDF using Aspose.Words.

I also attached my Tahoma font.

Best regards.

Since the problem is occuring when a file contains a bullet i don’t think Tahoma is the problem, perhaps the Symbol font is the problem since that is the font that Word says the bullet is. I have attached my Symbol font.

This problem is occuring on my Windows XP desktop and our Windows 2003 Server

Thank you for additional information. I still cannot reproduce the problem. The same fonts are installed on my side. I tried to convert your document to PDF on WinXP (32bit) and on Win2003 (32bit) and no errors occur.

Best regards.

So where does that leave us now? I am still having the problem here on my end.

I do not know what can be the difference. Do you use 64bit or 32bit OS? Maybe as a workaround, you can try using another kind of bullets. Also, please make sure that you are using the latest version of Aspose.Words in your project. To check version of the library, right click on the dll, select Properties from the context menu, then select Version tab. You will see File version.

Best regards.

I need to revisit this issue. I have downloaded and installed the latest version of Words 6.4.0 and still have the problem. This being ran from a 32 bit computer.

How can we get this resolved?

Thanks

Hi Robert,

Thanks for your request. I am still unable to reproduce the problem on my side. Could you please take a look whether the following some of the following fonts are installed on your PC:

Times New Roman E3

Times New Roman E3 Bold

Times New Roman E3 Italic

Times New Roman E3 Bold Italic

Or maybe some other Times New Roman or Arial fonts.

Best regards.

Attached is a screen shot of the contents of my C:\WINDOWS\Fonts

Also, attached is a copy of my Visual Studio version and System Information.

Thanks

Hi

Thank you for additional information. I am still unable to reproduce the problem. Please try changing font in your document to some other, to Arial for example (just for testing). I still think that problem occurs because there is some fonts on your PC which cannot be read properly by Aspose.Words.

Best regards.

Attached is one font file ARIALUNI.TTF

Attached are the fonts from my PC that start A-C

Attached are the fonts from my PC starting with the letter D-Z

I have just posted 3 posts that contain all of the fonts on my PC.

Hi Robert,

This information is really useful. I managed to reproduce the problem on my side. You will be notified as soon as the problem is resolved.

The problem is causes by PsfSYMBOL font.

Best regards.