aspose version :25.3
jdk:17
upload.docx (222.4 KB)
above the file .
code snippet
@Test
@SneakyThrows
public void tranPdf2() {
AsposeAccessor.InitialAccessor();
Document doc = new Document("C:\\Temp\\upload.docx");
doc.save("C:\\Temp\\uploadPdf.pdf");
}
it processing over 20 minutes , obviously its abnormal .
@pengpengon
It seems that you are experiencing unusually long processing times when converting a DOCX file to PDF using Aspose.Words. Here are a few suggestions to help troubleshoot and potentially improve the performance of your conversion process:
-
Check Document Complexity: The complexity of the document can significantly affect conversion time. If your DOCX file contains a lot of images, complex formatting, or large tables, it may take longer to process. Try simplifying the document or testing with a smaller or less complex file to see if the conversion time improves.
-
Update Aspose.Words: You are using version 25.3 of Aspose.Words. It’s a good idea to check if there are any updates or newer versions available. Performance improvements and bug fixes are often included in newer releases, which could help reduce processing time.
-
Optimize Memory Usage: Ensure that your application has sufficient memory allocated. If your application runs out of memory during the conversion, it may slow down significantly. Monitor memory usage during the conversion process to identify any potential issues.
-
Use a Stream for Saving: Instead of saving directly to a file, consider using a memory stream. This can sometimes improve performance, especially if you are performing multiple operations on the document. Here’s an example of how to implement this:
@Test
@SneakyThrows
public void tranPdf2() {
AsposeAccessor.InitialAccessor();
Document doc = new Document("C:\\Temp\\upload.docx");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
doc.save(outputStream, SaveFormat.PDF);
// Now you can write the outputStream to a file if needed
try (FileOutputStream fos = new FileOutputStream("C:\\Temp\\uploadPdf.pdf")) {
outputStream.writeTo(fos);
}
}
-
Profile the Code: If the issue persists, consider profiling your code to identify any bottlenecks during the conversion process. This can help you pinpoint specific areas that may be causing delays.
If you continue to experience issues after trying these suggestions, consider reaching out to Aspose support with detailed information about your document and the environment in which you are running the conversion. They may be able to provide more specific guidance based on your situation.
Feel free to ask if you have any further questions or need additional assistance!
and i get the thread log
"qtp1136890657-18642" #18642 prio=5 os_prio=0 cpu=1765288.80ms elapsed=318282.22s tid=0x00007422c000c140 nid=0x4b7d runnable [0x00007422408da000]
java.lang.Thread.State: RUNNABLE
at com.aspose.words.zzXmO.zzDA(Unknown Source)
at com.aspose.words.zzhw.zzWCP(Unknown Source)
at com.aspose.words.zzX6u.zzWCP(Unknown Source)
at com.aspose.words.zzXXK.zzX9m(Unknown Source)
at com.aspose.words.zzWr9.zzX0q(Unknown Source)
at com.aspose.words.zzWr9.zzrS(Unknown Source)
at com.aspose.words.zzWr9.zzZo1(Unknown Source)
at com.aspose.words.zzY9m.zzX0q(Unknown Source)
at com.aspose.words.zzY9m.zzXPO(Unknown Source)
at com.aspose.words.zzZMi.zzYXU(Unknown Source)
at com.aspose.words.zzZMi.zzX0q(Unknown Source)
at com.aspose.words.zzYqc.zzX9m(Unknown Source)
at com.aspose.words.zzYqc.zzZCf(Unknown Source)
at com.aspose.words.zzYqc.zzX9m(Unknown Source)
at com.aspose.words.zzWNk.zzLS(Unknown Source)
at com.aspose.words.zzWNk.zzX9m(Unknown Source)
at com.aspose.words.zzYs7.zzWXX(Unknown Source)
at com.aspose.words.zzYs7.zzZCf(Unknown Source)
at com.aspose.words.zzYs7.zzX0q(Unknown Source)
at com.aspose.words.zzX9L.zzY3T(Unknown Source)
at com.aspose.words.zzX9L.zzX9m(Unknown Source)
at com.aspose.words.zzX9L.zzX0q(Unknown Source)
at com.aspose.words.zzXIu.zzxi(Unknown Source)
at com.aspose.words.zzXIu.zzYXU(Unknown Source)
at com.aspose.words.zzXIu.zzYlt(Unknown Source)
at com.aspose.words.zzXIu.zzYI9(Unknown Source)
at com.aspose.words.zzXu1.zzYI9(Unknown Source)
at com.aspose.words.zzZgI.zzX9m(Unknown Source)
at com.aspose.words.zzYcz.zzYCW(Unknown Source)
at com.aspose.words.zzZoX.zzYLI(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zzYbi.zzYYu(Unknown Source)
at com.aspose.words.zzxJ.zzYKJ(Unknown Source)
at com.aspose.words.zzXJE.zz6X(Unknown Source)
at com.aspose.words.zzXJE.zzX9m(Unknown Source)
at com.aspose.words.zzXJE.zzX0q(Unknown Source)
at com.aspose.words.zzXJE.zzqU(Unknown Source)
at com.aspose.words.Document.zzY6U(Unknown Source)
at com.aspose.words.Document.zzX9m(Unknown Source)
at com.aspose.words.Document.zzX0q(Unknown Source)
at com.aspose.words.Document.zzX0q(Unknown Source)
at com.aspose.words.Document.zzXAn(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at cn.keking.config.AsposeAccessor.officeConvertToPdf(AsposeAccessor.java:386)
at cn.keking.service.OfficeToPdfService.lambda$converterFile2$2(OfficeToPdfService.java:131)
at cn.keking.service.OfficeToPdfService$$Lambda$1425/0x0000742330e9d1c8.apply(Unknown Source)
at java.util.Optional.map(java.base@17.0.12/Optional.java:260)
at cn.keking.service.OfficeToPdfService.converterFile2(OfficeToPdfService.java:108)
at cn.keking.service.impl.trans.OfficeTransService.resourceTrans(OfficeTransService.java:59)
at cn.keking.web.controller.FileController.viewFile(FileController.java:145)
at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.12/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java.base@17.0.12/Method.java:569)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:926)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:831)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
at org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:736)
at org.eclipse.jetty.ee10.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1614)
at org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:195)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at cn.keking.web.filter.SecurityFilterProxy.doFilterInternal(SecurityFilterProxy.java:29)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at cn.keking.web.filter.ChinesePathFilter.doFilter(ChinesePathFilter.java:21)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
at org.eclipse.jetty.ee10.servlet.ServletHandler$MappedServlet.handle(ServletHandler.java:1547)
at org.eclipse.jetty.ee10.servlet.ServletChannel.dispatch(ServletChannel.java:824)
at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:436)
at org.eclipse.jetty.ee10.servlet.ServletHandler.handle(ServletHandler.java:464)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
at org.eclipse.jetty.ee10.servlet.SessionHandler.handle(SessionHandler.java:703)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
at org.eclipse.jetty.server.Server.handle(Server.java:179)
at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:635)
at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:411)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99)
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:478)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:441)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:201)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:311)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164)
at java.lang.Thread.run(java.base@17.0.12/Thread.java:840)
@pengpengon
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28141
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
but it worked on the old version 23.9
@pengpengon Thank you for additional information. We will keep you updated and let you know once the problem is resolved. Please accept our apologies for your inconvenience.
SMP-QC-040-01 Empower3网络版色谱系统管理规程.docx (5.1 MB)
same in this file .
What reason should be the root case of the issue? What type or format of documents will have this kind issue?
@pengpengon
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28152
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.