Unalbe to create FreeTextAnnotation

Hi,

I am evaluating Aspose Android PDF library (1.5.0), and I am having trouble creating a new FreeTextAnnotation.

The code:

// Create Free Text annotation
com.aspose.pdf.Page page1 = doc.getPages().get_Item(1);
com.aspose.pdf.Rectangle rectangle = new com.aspose.pdf.Rectangle(100, 100, 300, 300);
com.aspose.pdf.DefaultAppearance defaultAppearance =
new com.aspose.pdf.DefaultAppearance(FontRepository.findFont("Arial"), 10, com.aspose.java.awt.Color.BLUE);
com.aspose.pdf.FreeTextAnnotation textAnnotation = new com.aspose.pdf.FreeTextAnnotation(page1, rectangle, defaultAppearance);

The last line of the code (the constructor) crashes with this:

03-30 17:01:37.956 16828-16828/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.xyz.prototype, PID: 16828
java.util.regex.PatternSyntaxException: Incorrect Unicode property near index 19:
text-align:\s*([\pL\pM\p{Nd}\p{Nl}\p{Pc}[\p{InEnclosedAlphanumerics}&&\p{So}]]+)\W
^
at java.util.regex.Pattern.compileImpl(Native Method)
at java.util.regex.Pattern.compile(Pattern.java:411)
at java.util.regex.Pattern.(Pattern.java:394)
at java.util.regex.Pattern.compile(Pattern.java:374)
at com.aspose.ms.System.Text.RegularExpressions.Regex.(Unknown Source)
at com.aspose.pdf.TextStyle.(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.getTextStyle(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.(Unknown Source)
at com.xyz.prototype.PdfRenderingTestFragment.renderPdf(PdfRenderingTestFragment.java:97)
at com.xyz.prototype.PdfRenderingTestFragment.access$100(PdfRenderingTestFragment.java:22)
at com.xyz.prototype.PdfRenderingTestFragment$1.onClick(PdfRenderingTestFragment.java:39)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)


I can't figure out what's the problem. I used an official Aspose sample for Java, so in theory it should be valid. Does anyone have any ideas?

--

Thanks,

Vit Khudenko

+1

I see the same issue even with PdfContentEditor:

PdfContentEditor editor = new PdfContentEditor();
editor.bindPdf(Environment.getExternalStorageDirectory().getAbsolutePath() + "/HelloWorld.pdf");
editor.createFreeText(new com.aspose.java.awt.Rectangle(0, 0, 100, 100), "OLOLOLO", 1);
editor.save(Environment.getExternalStorageDirectory().getAbsolutePath() + "/TextStamp.pdf");

And here is what i got:
java.util.regex.PatternSyntaxException: Incorrect Unicode property near index 19:
text-align:\s*([\pL\pM\p{Nd}\p{Nl}\p{Pc}[\p{InEnclosedAlphanumerics}&&\p{So}]]+)\W
^
at java.util.regex.Pattern.compileImpl(Native Method)
at java.util.regex.Pattern.compile(Pattern.java:411)
at java.util.regex.Pattern.(Pattern.java:394)
at java.util.regex.Pattern.compile(Pattern.java:374)
at com.aspose.ms.System.Text.RegularExpressions.Regex.(Unknown Source)
at com.aspose.pdf.TextStyle.(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.getTextStyle(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.(Unknown Source)
at com.aspose.pdf.facades.PdfContentEditor.createFreeText(Unknown Source)


P.S. i'm using temporary license (in case if it matters)

Env.: Nexus 5; Android 5.0.1; Aspose PDF Android 1.5

Hi,


Thanks for contacting support.

We are testing these scenarios in our environment and will get back to you soon.
Hi Vit,

adenisyuk:
+1

I see the same issue even with PdfContentEditor:

PdfContentEditor editor = new PdfContentEditor();
editor.bindPdf(Environment.getExternalStorageDirectory().getAbsolutePath() + "/HelloWorld.pdf");
editor.createFreeText(new com.aspose.java.awt.Rectangle(0, 0, 100, 100), "OLOLOLO", 1);
editor.save(Environment.getExternalStorageDirectory().getAbsolutePath() + "/TextStamp.pdf");

And here is what i got:
java.util.regex.PatternSyntaxException: Incorrect Unicode property near index 19:
text-align:\s*([\pL\pM\p{Nd}\p{Nl}\p{Pc}[\p{InEnclosedAlphanumerics}&&\p{So}]]+)\W
^
at java.util.regex.Pattern.compileImpl(Native Method)
at java.util.regex.Pattern.compile(Pattern.java:411)
at java.util.regex.Pattern.(Pattern.java:394)
at java.util.regex.Pattern.compile(Pattern.java:374)
at com.aspose.ms.System.Text.RegularExpressions.Regex.(Unknown Source)
at com.aspose.pdf.TextStyle.(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.getTextStyle(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.(Unknown Source)
at com.aspose.pdf.facades.PdfContentEditor.createFreeText(Unknown Source)


P.S. i'm using temporary license (in case if it matters)

Env.: Nexus 5; Android 5.0.1; Aspose PDF Android 1.5

Thanks for your findings. We have noticed the reported exception with PdfContenEditor, so logged a ticket PDFANDROID-330 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,
Hi Vit,

vkhudenko:
Hi,

I am evaluating Aspose Android PDF library (1.5.0), and I am having trouble creating a new FreeTextAnnotation.

The code:

// Create Free Text annotation
com.aspose.pdf.Page page1 = doc.getPages().get_Item(1);
com.aspose.pdf.Rectangle rectangle = new com.aspose.pdf.Rectangle(100, 100, 300, 300);
com.aspose.pdf.DefaultAppearance defaultAppearance =
new com.aspose.pdf.DefaultAppearance(FontRepository.findFont("Arial"), 10, com.aspose.java.awt.Color.BLUE);
com.aspose.pdf.FreeTextAnnotation textAnnotation = new com.aspose.pdf.FreeTextAnnotation(page1, rectangle, defaultAppearance);

The last line of the code (the constructor) crashes with this:

03-30 17:01:37.956 16828-16828/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.xyz.prototype, PID: 16828
java.util.regex.PatternSyntaxException: Incorrect Unicode property near index 19:
text-align:\s*([\pL\pM\p{Nd}\p{Nl}\p{Pc}[\p{InEnclosedAlphanumerics}&&\p{So}]]+)\W
^
at java.util.regex.Pattern.compileImpl(Native Method)
at java.util.regex.Pattern.compile(Pattern.java:411)
at java.util.regex.Pattern.(Pattern.java:394)
at java.util.regex.Pattern.compile(Pattern.java:374)
at com.aspose.ms.System.Text.RegularExpressions.Regex.(Unknown Source)
at com.aspose.pdf.TextStyle.(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.getTextStyle(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.(Unknown Source)
at com.xyz.prototype.PdfRenderingTestFragment.renderPdf(PdfRenderingTestFragment.java:97)
at com.xyz.prototype.PdfRenderingTestFragment.access$100(PdfRenderingTestFragment.java:22)
at com.xyz.prototype.PdfRenderingTestFragment$1.onClick(PdfRenderingTestFragment.java:39)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)


I can't figure out what's the problem. I used an official Aspose sample for Java, so in theory it should be valid. Does anyone have any ideas?

--

Thanks,

Vit Khudenko


Thanks for your inquiry. We have tested the scenario and noticed the reported exception. We have logged a ticket PDFANDROID-331 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFANDROID-331;PDFANDROID-330) have been fixed in Aspose.Pdf for Android 1.6.0.


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