Conversion to pdf on Mac OS Only

We use java total version with cell 8.0.0.

When email message file is converted to pdf file, has these error message.
The msg file has excel attachment.
It is on in window system.
It is happened on Mac OS only.
Mac OS 10.8.2, Apache Tomcat/7.0.30, Java 1.6.0_35-b10-428-11M3811


<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Malgun Gothic”;mso-fareast-theme-font:minor-fareast;
mso-ansi-language:EN-US;mso-fareast-language:KO;mso-bidi-language:AR-SA”>com.aspose.cells.CellsException
at com.aspose.cells.bgp.a(Unknown Source) at
com.aspose.cells.Workbook.a(Unknown Source) at
com.aspose.cells.Workbook.save(Unknown Source) at <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>KO</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
<w:UseFELayout/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Malgun Gothic”;mso-fareast-theme-font:minor-fareast;
mso-ansi-language:EN-US;mso-fareast-language:KO;mso-bidi-language:AR-SA”>java.io.IOException:
PDF header signature error. at com.aspose.pdf.kit.ls.k(Unknown Source) at
com.aspose.pdf.kit.pd.a(Unknown Source) at com.aspose.pdf.kit.pd.(Unknown
Source) at com.aspose.pdf.kit.pd.(Unknown Source) at
com.aspose.pdf.kit.PdfFileEditor.a(Unknown Source) at
com.aspose.pdf.kit.PdfFileEditor.concatenate(Unknown Source) at
com.all.crm.service.ConvertCommHistoryMSGtoPDF.process(ConvertCommHistoryMSGtoPDF.java:374)
at <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>KO</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
<w:UseFELayout/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

Old version 7.5.3 had similar problem.

Thanks,
Chang Shin

Thanks,

HI Chang,


Thank you for contacting Aspose support.

As your presented scenario involves multiple Aspose APIs therefore it is hard to detect which API is contributing most to the problem as stated in your post. It would be of great help in isolating the problem cause, and to provide a fix if you can provide a sample console application replicating your complete scenario along with template input files. As soon as we review the aforesaid information, we will be in a better position to assist you further in this regard.

I just tested 8.0.1. I have same error message.
I can’t send out any company document file.

Thanks,
Chang Shin

Hi Chang,


Sorry to know that the latest version didn’t help in your scenario.

I am afraid, we may not be able to identify the problem cause without your help in this regard. Therefore we would request you again to create a sample application just for issue replication and share your input file after removing any sensitive information. Moreover, if you do not wish to share the sample on public forum, you may send an email using the “Contact” button on post window.

Thanks in advance for your cooperation & understanding.

Fortunately, we made up the phony data and got the same error message.
Please test attached excel file on Mac OS. then let me know.

Thanks,
Chang Shin

Hi Chang,


Thank you for providing the sample spreadsheet.

We are looking into this matter to reproduce the said exception, and we will shortly get back to you with updates in this regard.

Hi Chang,


We have tested your provided spreadsheet on MAC OS 10.8.3 with JDK 1.6.0_25 against the latest build of Aspose.Cells for Java 8.0.1. Unfortunately, we are unable to experience any exception with the following piece of code. Please check the attached resultant PDF file for your reference.

Java

Workbook book = new Workbook(myDir + “2014 Q1 - memeyouyou techno.xls”);
book.save(myDir + “output.pdf”, SaveFormat.PDF);

In order to move further with the stated issue, we will require a sample console application as requested before to replicate the issue, and to move forward towards the correction.

It is my code:

The red light line, pbeRoot.setSubEntry(subEntryList); has the error message.

// Add PDF Bookmarks|Documentation

public void xlsToPdf() {
try {
com.aspose.cells.License license = new com.aspose.cells.License();
String rootFolder = generalService.getSystemRootFolder();
File file = new File(rootFolder,“Aspose.Total.Java.lic”);
FileInputStream fiStream=new FileInputStream(file);
//InputStream fiStream = getClass().getResourceAsStream("/Aspose.Total.Java.lic");
if ( fiStream == null ) {
log.info(“fiStream is null”);
return;
}
license.setLicense(fiStream);
log.info(“xlsToPdf(),fiStream is not null”);
sheetNames = new ArrayList();
//Initialize a new Workbook
//Open an Excel file
Workbook workbook = new Workbook(baseFolder+ fileName);

WorksheetCollection worksheets = workbook.getWorksheets();

ArrayList subEntryList = new ArrayList();
//Create the PdfBookmark entry object.
PdfBookmarkEntry pbeRoot = new PdfBookmarkEntry();
//Set the bookmark collapsed.
pbeRoot.setOpen(false);
//Set its text.
pbeRoot.setText(fileName);
Cell cellInPage = null;
Row row = null;
//Set its destination source page.
pbeRoot.setDestination(cellInPage);
PdfBookmarkEntry subPbe = null;
for ( int i = 0; i < worksheets.getCount(); i++ ) {
Worksheet worksheet = worksheets.get(i);
cellInPage = getFirstNotHiddenCell(worksheet);
//Add another PdfBookmark entry object.
subPbe = new PdfBookmarkEntry();
//Set its text.
String sheetName = worksheet.getName();
if ( sheetName == null || sheetName.equals("") ) {
sheetName = “Sheet " + (i+1);
}
sheetNames.add(sheetName);
subPbe.setText(sheetName);
//Set its destination source page.
subPbe.setDestination(cellInPage);

//Add the entry objects to it.
subEntryList.add(subPbe);

}

pbeRoot.setSubEntry(subEntryList);


//Implement one page per worksheet option
com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
//Set the pdf bookmarks, you need to specify the root object here.
//pdfSaveOptions.setCompliance(1);
if ( generalService.getServerDomainName().indexOf(“localhost”) < 0 ) {
CellsHelper.setFontDir(”/System/Library/Fonts");
log.info(“CellsHelper.setFontDir(’/System/Library/Fonts’);”);
}

//pdfSaveOptions.setBookmark(pbeRoot);
//Set the pdf bookmarks, you need to specify the root object here.
//workbook.getSaveOptions().setPdfBookmark(pbeRoot);
///Save the pdf file
log.info(“baseFodler filename=”+this.baseFolder + pdfFileName);
workbook.save(this.baseFolder + pdfFileName, pdfSaveOptions); //// has evaluation font error
//Save only one current worksheet
//workbook.save(baseFolder + pdfFileName, FileFormatType.PDF); // has evaluation font error
//workbook.save(baseFolder + pdfFileName, com.aspose.cells.SaveFormat.PDF);
} catch ( Exception ex ) {
errorMessages.append(LF+“xlsToPdf error=”+ex.getMessage());
log.info(“xlsToPdf(),ex=” + MyUtil.exceptionLog(ex));
//ex.printStackTrace();
}
} // end of xlsToPdf

getFirstNotHiddenCell method was missed.

public Cell getFirstNotHiddenCell(Worksheet worksheet ) {
Cell cell = null;

try {
int maxRow = worksheet.getCells().getMaxRow();
int maxCol = worksheet.getCells().getMaxColumn();
for (int i = 0; i < maxRow; i++ ) {
if ( !worksheet.getCells().isRowHidden(i) ) {
//cellInPage = worksheet.getCells().getCell(i, 0);
for ( int j = 0; j < maxCol; j++ ) {
if ( !worksheet.getCells().isColumnHidden(j) ) {
cell = worksheet.getCells().getCell(i, j);
// System.out.println(worksheet.getName() + " not hidden cell="+j+":"+j);
i = maxRow;
break;
}
}
}
}
} catch ( Exception ex ) {
ex.printStackTrace();
}
if ( cell == null ) {
cell = worksheet.getCells().get(“A1”); //default cell
}
return cell;
}

Hi Chang,


Thank you for providing complete source code. As a standard procedure, I have quickly tested the source code snippet against your provided spreadsheet with Aspose.Cells for Java 8.0.1 on Windows 7 platform. Unfortunately, I was unable to see any exception therefore I am now moving forward to test the same on MAC OS. I will shortly respond back with more details in this regard.

Hi Chang,


We have executed your provided code against the latest version of Aspose.Cells for Java 8.0.1 and your provided spreadsheet. Unfortunately we were unable to see any exception during the process. Please find the attachment for the resultant PDF file.

Please confirm the following on your end in order to make sure that we moving towards the right direction,

  1. You are using the latest version of Aspose.Cells for Java 8.0.1. Please note, you have to reference two Jar files in your project, that is; aspose.cells-8.0.1.jar & bcprov-jdk16-146.jar. We would suggest you to remove the references and add them again to give it another try.
  2. Please confirm the recently shared code snippet and previously shared source template spreadsheet would enable us to experience the exception.
  3. In you first post as quoted below, the exception seems to be thrown by Workbook.save method whereas in your recent comments you have mentioned that the pbeRoot.setSubEntry(subEntryList) statement is triggering the exception. Please provide the complete exception message and stack trace.
Chang Shin:
com.aspose.cells.CellsException at com.aspose.cells.bgp.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at com.aspose.cells.Workbook.save(Unknown Source) at

I already tested the two jar files.
It is happened in Mac OS side ONLY. It is on in Window.

It is the error codes:

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Malgun Gothic”;mso-fareast-theme-font:minor-fareast;
mso-ansi-language:EN-US;mso-fareast-language:KO;mso-bidi-language:AR-SA”>com.aspose.cells.CellsException
at com.aspose.cells.bgq.a(Unknown Source) at
com.aspose.cells.Workbook.a(Unknown Source) at
com.aspose.cells.Workbook.save(Unknown Source) at
com.all.crm.service.ConvertCommHistoryMSGtoPDF.XlsToPDF(ConvertCommHistoryMSGtoPDF.java:2102)
at
com.all.crm.service.ConvertCommHistoryMSGtoPDF.process(ConvertCommHistoryMSGtoPDF.java:309)
at
com.all.crm.service.CommHistoryService.saveCommHistoryUpload(CommHistoryService.java:722)
at com.all.crm.web.controller.FileHistoryNewUploadController.fileHistoryNewUploadPost(FileHistoryNewUploadController.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)



<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>KO</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
<w:UseFELayout/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

I found the problem.
The setFontDir has the trouble.
If I blocked the red line, it is ok.
As I know, if the red line is blocked, other case has another problem.
The error message might be “com.aspose.cells.CellsException: File path can’t be “”. at com.aspose.cells.bdg.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at “
Please let me know what I have to do.


com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
if ( generalService.getServerDomainName().indexOf(“localhost”) < 0 ) {
CellsHelper.setFontDir(”/System/Library/Fonts”);
log.info(“CellsHelper.setFontDir(’/System/Library/Fonts’);”);
}
workbook.save(baseFolder+ “temp/” + pdfFileName, pdfSaveOptions);

Thanks,
Chang Shin

Hi Chang,


Thank you for your valuable feedback.

We are able to observe the exception as stated here while converting your provided spreadsheet to PDF with Aspose.Cells for Java 8.0.1 on MAC OS 10.8.3. For further investigation and correction, the issue has been logged in our bug tracking system under ticket CELLSJAVA-40800. Please spare us little time to properly analyze the problem cause, and to provide a fix at earliest. In the meanwhile, we will keep you posted with updates in this regard.

Chang Shin:
If I blocked the red line, it is ok.
As I know, if the red line is blocked, other case has another problem.
The error message might be "com.aspose.cells.CellsException: File path can't be "". at com.aspose.cells.bdg.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at "
Please let me know what I have to do.


com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
if ( generalService.getServerDomainName().indexOf("localhost") < 0 ) {
CellsHelper.setFontDir("/System/Library/Fonts");
log.info("CellsHelper.setFontDir('/System/Library/Fonts');");
}
workbook.save(baseFolder+ "temp/" + pdfFileName, pdfSaveOptions);
In reference to your comments as quoted above, could you please help us replicate the CellsException: File path can't be ""? Please provide details regarding the said exception so we could replicate it on our end before logging a ticket for correction purposes.

Thank you for your cooperation and continues support.

Hi,


Please try our latest version/fix: Aspose.Cells for Java v8.0.1.3 (attached).

We have fixed your issue now.

Let us know your feedback.

Thank you.

It is fixed.
Good job!

Thanks,
Chang Shin




Hi,


Thanks for your feedback.

Good to know that your issue is resolved by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.