We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exceptions using TextFragmentAbsorber in version 4.6.0

After upgrading to latest version of Aspose.Pdf for Java, namely 4.6.0, we are getting the following exception:

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>14</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>IT</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<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]–><span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
IT;mso-fareast-language:IT;mso-bidi-language:AR-SA”>java.security.AccessControlException:
access denied (“java.io.FilePermission” “C:\WINDOWS\Fonts”
“read”)

at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)

at java.security.AccessController.checkPermission(AccessController.java:560)

at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)

at java.lang.SecurityManager.checkRead(SecurityManager.java:888)

at java.io.File.exists(File.java:770)

at com.aspose.pdf.b.c.g.c.p.a(Unknown Source)

at com.aspose.pdf.b.c.g.c.p.populateMaps(Unknown Source)

at com.aspose.pdf.b.c.g.c.p.dcS(Unknown Source)

at com.aspose.pdf.b.c.g.c.p.dcR(Unknown Source)

at com.aspose.pdf.b.c.g.c.b.a.g(Unknown Source)

at com.aspose.pdf.b.c.g.c.ac.ddZ(Unknown Source)

at com.aspose.pdf.b.c.g.c.ac.isAccessible(Unknown Source)

at com.aspose.pdf.Font.a(Unknown Source)

at com.aspose.pdf.Font.(Unknown Source)

at com.aspose.pdf.FontCollection.cOH(Unknown Source)

at com.aspose.pdf.FontCollection.(Unknown Source)

at com.aspose.pdf.Resources.getFonts(Unknown Source)

at com.aspose.pdf.b.c.g.d.l.a(Unknown Source)

at com.aspose.pdf.b.c.g.d.l.parse(Unknown Source)

at com.aspose.pdf.b.c.g.d.n.a(Unknown Source)

at com.aspose.pdf.b.c.g.d.n.a(Unknown Source)

at com.aspose.pdf.b.c.g.d.n.deV(Unknown Source)

at com.aspose.pdf.b.c.g.d.n.(Unknown Source)

at com.aspose.pdf.TextFragmentAbsorber.visit(Unknown Source)

at com.agews.suite626.util.Util.placeSignatureFields(Util.java:300)

at com.agews.suite626.servlet.old.Servlet.save(Servlet.java:112)

at com.agews.suite626.servlet.old.Servlet.output(Servlet.java:614)

at com.agews.suite626.servlet.old.SingleReport.process(SingleReport.java:59)

at com.agews.suite626.servlet.old.Servlet.doPost(Servlet.java:157)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)

at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)

at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)

at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:169)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:299)

at
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:57)

at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:193)

at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)

at java.security.AccessController.doPrivileged(Native Method)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

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:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)

at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:722)

Here you notice that the library is for some<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tabella normale"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; 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-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–> reason looking for fonts in C:\Windows\Fonts, but since this is a CentOs machine, that folder clearly does not exists and also causes an exception for an access violation in the Java security manager; also the fonts folder had already been set calling FontSettings.setFontsFolder() in a previous moment.

This did NOT happen using version 4.2.1, and we would like this bug to be fixed, since if it is not we cannot update the library.

Hi Matteo,


We are sorry for the inconvenience. Please note you can use following methods to get system folder of fonts or set font path to font folders. Hopefully it will help you to fix the issue.

Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
Document.setLocalFontPath (String) - Setting font path to custom folder

//adding a new font path<o:p></o:p>

String path = “c:\fonts\”;<o:p></o:p>

com.aspose.pdf.Document.addLocalFontPath(path);<o:p></o:p>


Moreover please also check following code snippet to set font path if there are more than one font path.


//geting the list for standard font directories in different OS<o:p></o:p>

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();<o:p></o:p>

//seting the user list for standard font directories<o:p></o:p>

list.add(“c:\fonts2\”);<o:p></o:p>

list.add(“c:\fonts3\”);<o:p></o:p>

com.aspose.pdf.Document.setLocalFontPaths(list);<o:p></o:p>

//Restoring list for standard font directories by default.<o:p></o:p>

com.aspose.pdf.Document.restoreLocalFontPath();<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>

The suggested fix seems to work, thanks.

However, I would like to underline that I did not need such explicit code using previous 4.2.1 version.

While I do understand that sometimes it is necessary to create some backward incompatibility when updating a software, it is not nice when your application stops working for a simple library update.

Was this documented at all, anywhere?

Hi Matteo,


Thanks for your feedback. It is good to know your issue has been resolved.

We are sorry for the inconvenience caused due to change. We have announced the change but not listed in documentation. However, we are adding this in documentation to avoid any further inconvenience to any-other community member.

Best Regards,