Aspose.Words 4.0.0 PDF Generation bug

I am creating a very simple document and am able to save it out as a word document, when I save it out as a PDF document I get an exception inside the Aspose code. Here is what I am doing:

try
{
    if (extension.equalsIgnoreCase("doc"))
    {
        response.setContentType("application/msword");
        document.save(response.getOutputStream(), SaveFormat.DOC);
    }
    else
    {
        response.setContentType("application/pdf");
        PdfOptions options = new PdfOptions();
        options.setHeadingsOutlineLevels(3);
        options.setExpandedOutlineLevels(1);
        options.setTrueTypeFontsFolder("/System/Library/Fonts");
        document.saveToPdf(0, document.getPageCount(), response.getOutputStream(), options);
    }

}
catch (Exception e)
{
    e.printStackTrace();
    return "Problem exporting word document: " + e.getMessage();
}

Is this something that should work? The exception that is is thrown is as follows. I wonder does the exception give any clues into what I might need to do to workaround this unfortunate issue? It is entirely possible that I do not have all of the fonts required. How do I determine which fonts the document will need? I know I am using Helvetica for sure.

java.lang.IllegalStateException: End of file reached.
at asposewobfuscated.rm.lM(BigEndianBinaryReader.java: 114)
at asposewobfuscated.rm.iW(BigEndianBinaryReader.java: 39)
at asposewobfuscated.qx.UL(TTFontFiler.java: 351)
at asposewobfuscated.qx.iy(TTFontFiler.java: 200)
at asposewobfuscated.qx.iF(TTFontFiler.java: 775)
at asposewobfuscated.qx.UW(TTFontFiler.java: 752)
at asposewobfuscated.qx.iz(TTFontFiler.java: 321)
at asposewobfuscated.qx.B(TTFontFiler.java: 117)
at asposewobfuscated.qx.A(TTFontFiler.java: 42)
at asposewobfuscated.oa.hc(PalFont.java: 24)
at com.aspose.words.xb.Hd(SpanPr.java: 231)
at com.aspose.words.sf.rr(Span.java: 730)
at com.aspose.words.sf.getWidth(Span.java: 593)
at com.aspose.words.zq.Jy(LineBuilder.java: 88)
at com.aspose.words.zq.Jx(LineBuilder.java: 30)
at com.aspose.words.bz.V(LinePart.java: 281)
at com.aspose.words.dr.a(CellBuilder.java: 278)
at com.aspose.words.dr.a(CellBuilder.java: 59)
at com.aspose.words.mk.V(CellPart.java: 190)
at com.aspose.words.da.a(RowBuilder.java: 48)
at com.aspose.words.agu.V(RowPart.java: 104)
at com.aspose.words.ay.V(HeaderFooterPart.java: 154)
at com.aspose.words.ahj.nG(HeaderFooterSectionLayout.java: 55)
at com.aspose.words.ql.nG(StoryLayoutBase.java: 88)
at com.aspose.words.mw.d(PageBuilder.java: 368)
at com.aspose.words.mw.a(PageBuilder.java: 37)
at com.aspose.words.aji.b(SectionReflower.java: 40)
at com.aspose.words.il.nG(MainTextSectionLayout.java: 757)
at com.aspose.words.ql.nG(StoryLayoutBase.java: 88)
at com.aspose.words.mu.nG(PageLayoutModel.java: 124)
at com.aspose.words.yz.a(LayoutDocument.java: 33)
at com.aspose.words.Document.updatePageLayout(Document.java: 1637)
at com.aspose.words.Document.Iu(Document.java: 1590)
at com.aspose.words.Document.getPageCount(Document.java: 1618)
at au.edu.unimelb.policy.servlet.PdfServlet.generateDocument(PdfServlet.java:136)
at au.edu.unimelb.policy.servlet.PdfServlet.doPost(PdfServlet.java:108)
at au.edu.unimelb.policy.servlet.PdfServlet.doGet(PdfServlet.java:72)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 206)
at au.edu.unimelb.security.AuthorisationFilter.urlFilter(AuthorisationFilter.java: 508)
at au.edu.unimelb.security.AuthorisationFilter.doFilter(AuthorisationFilter.java: 199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 206)
at au.edu.unimelb.policy.UrlFilter.doFilter(UrlFilter.java: 139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447)
at java.lang.Thread.run(Thread.java:637)

Hi

Thanks for your request. Could you please attach your document here for testing? I will check it on my side and provide you more information.
As I can see, you perform converting to PDF in Linux environment. Am I right?
Also, the was problems with saving PDFs to stream in this version of Aspose.Words for Java (note this feature is in beta). So please try saving the output PDF to file and let me know how it goes on your side.
Best regards.