Save to PDF- XPS- JPG- BMP Error

Hi,

I have an error that occurs only on a couple of workstations when saving to PDF. This may be a hard one for you to reproduce as it only occurs on a couple of workstations. This error occurs for any document including a blank document created on the workstation with the issue.

Also this also Happens when Saving to XPS,JPG,BMP. Saving to the Word formats Doc, Docx etc work fine.

The workstation that this error occurs on is Windows 7 64bit, but it also successfully works on a different workstation with the same configuration. Could it be related to an environmental Font / security issue on converting the document? Can you suggest any options that may work around this issue?

I am using Words 9.2, the code is as below

OpenFileDialog dlg = new OpenFileDialog();
(dlg.ShowDialog() == DialogResult.OK)
{
    Aspose.Words.Document doc = new Aspose.Words.Document(dlg.FileName);
    doc.Save(System.IO.Path.GetDirectoryName(dlg.FileName) + "\OutTest.pdf", Aspose.Words.SaveFormat.Pdf);
}

Stack Trace

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text 
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.ReadInt32()
at x6c95d9cf46ff5f25.xa8866d7566da0aa2.x95ea7d23cc8ee04d()
at xc23bef7190ca8f55.x6412d0c71c34c05c.x796bceaf1a71d638()
at xc23bef7190ca8f55.x6412d0c71c34c05c.xc5539ef56f278c00()
at xc23bef7190ca8f55.x6412d0c71c34c05c.xecc762181249f892(String xafe2f3653ee64ebc)
at xc23bef7190ca8f55.x6412d0c71c34c05c.x99a36cf35453249e(String x4fd966aaf32161e8)
at xc23bef7190ca8f55.x6412d0c71c34c05c.get_x99f0e2a5ac5ce2db()
at xc23bef7190ca8f55.x6412d0c71c34c05c.x7c720c8bae578197(String xa79a9f649c74f4a4)
at xc23bef7190ca8f55.x6412d0c71c34c05c.xdc2247c8d4648ae8(String xa79a9f649c74f4a4, FontStyle x44ecfea61c937b8e)
at xc23bef7190ca8f55.x6412d0c71c34c05c.x9059a3203c8fc855(String xa79a9f649c74f4a4, FontStyle x44ecfea61c937b8e, String x050683ee5a5f962b)
at x59d6a4fc5007b7a4.xacc55eb1e4595209.xc06de25aa714683f(x1d1dd20018fcde10 x26094932cf7a9139, x000f21cbda739311 x6f02b6a80bf6b36f)
at x59d6a4fc5007b7a4.x4f38812d0d5e7231.xbfac429e165a6a0d.xee5277c7de5be8e4(Char x3c4da2980d043c95)
at x59d6a4fc5007b7a4.x4f38812d0d5e7231.xbfac429e165a6a0d.MoveNext()
at x59d6a4fc5007b7a4.x4f38812d0d5e7231.x4fb8d507f4b3c96e(Font x0078185e1040c523, String xb41faee6912a2313, x000f21cbda739311 xcb075c7088c3b520)
at xf989f31a236ff98c.x08802e9e984cd3ee.xc325f08e9c7ac384()
at xf989f31a236ff98c.x08802e9e984cd3ee.xd22cb714335f8d2c(String xb41faee6912a2313, Font x26094932cf7a9139)
at x59d6a4fc5007b7a4.x4f38812d0d5e7231... ctor(String text, x1d1dd20018fcde10 font, xacc55eb1e4595209 converter)
at x59d6a4fc5007b7a4.x42f2a218ce59dafb.xbd6559e9bd341cd6(Inline xda5bf54deb817e37, Int32 x10aaa7cdfa38f254, Int32 x961016a387451f05)
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x4e33137198fdb9ca(Boolean xcd31b50c43a96e21)
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.MoveNext()
at x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
at Aspose.Words.Document.UpdatePageLayout()
at Aspose.Words.Document.get_xcde671c53995c411()
at x6a671772ec29137f.xcd769e39c0788209.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
at Aspose.Words.Document.Save(String fileName, SaveFormat saveFormat)
at Aspose.Append.Form1.button3_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message & m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message & m)
at System.Windows.Forms.ButtonBase.WndProc(Message & m)
at System.Windows.Forms.Button.WndProc(Message & m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message & m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message & m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Loaded Assemblies
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Aspose.Append
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file://SERVER1/RedirectedFolders/andrew/Desktop/PDF%20Save%20Test/Aspose.Append.exe
----------------------------------------
Aspose.Words
Assembly Version: 9.3.0.0
Win32 Version: 9.3.0.0
CodeBase: file://SERVER1/RedirectedFolders/andrew/Desktop/PDF%20Save%20Test/Aspose.Words.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<system.windows.forms jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Hi

Thank you for additional information. During rendering documents Aspose.Words reads font files and creates subsets of fonts, which are used in PDF and XPS. This is needed to reduce size of output files.
So I think that the reason of the problem is fonts. Do you have any additional fonts installed on these PCs? Could you please compare lists of fonts on PCs where code works fine and on PCs where code fails? If you will find some difference, please send me additional fonts, which are installed on PCs where code fails.
Best regards,

Hi,

I have noticed that there are fonts on the workstation that fails which are shortcuts to the C:\Program Files Directory . . .

could this be having an effect?

Thanks Bruce

Hi,

I outputted the Fonts to a listing and compared using Access in a query. Here are the fonts from the non-working workstation that are not present on the working workstation.

Where are the subsets created? In Memory or on Disk?

I installed these fonts to the working machine and it still works. Is there any workaround?

Thanks Bruce

Hi

Thank you for additional information. Subset of fonts creates in memory.
I have checked the fonts you attached, and there is no problem with them on my side (I use Windows 7 x64 for testing).
Best regards,

Thanks,

This issue also happens on a clients machine. We cannot really ask them for a Font listing, what is required is a generic fix or else we cannot use Words to save to PDFs as we can never know if there is some mis behaving Font that will cause it to crash.

Can we please submit this as a bug/feature request fix as soon as possible?

Thanks Bruce

Hi Bruce,

Thank you for additional information. In the next version of Aspose.Words, we will consider making font reading process to be silent, i.e. ignore fonts that cause errors upon reading. This should resolve your problem. We will let you know once the next version of Aspose.Words comes out.
Best regards,

Thanks,

I look forward to this change, otherwise deploying to environments you don’t control becomes impossible in this scenario.

Will there be an issue ID so that I can be notified when this behavior is changed?

Hi

Thanks for your inquiry. This forum thread has been linked to the appropriate issue. So the notification will be posted automatically in this thread once the release that includes the fix comes out.
Best regards,

Hi,

Calling UpdatePageLayout() in the affected system seems to cause the same or related issue.

Cheers Bruc

Hi

Thanks you for additional information. Yes, this was expected, because UpdatePageLayout use the same Rendering Engine, so also reads fonts installed on your PC. The fix will be included into the next version of Aspose.Words, which comes out in a week or so. We will notify you.
Best regards,

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

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