Free Support Forum - aspose.com

Aspose PDF in JAVA Symbols like $p $P #$NL #$NP won't work

Hello,
with Aspose PDF in Java i am not able to use the Symbols for “new line” and Page number and others.
I use the Symbols from "http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/symbols-list-and-purpose.html"

Code:

Section sec1 = pdf1.getSections().add();
Paragraphs paragraphs = sec1.getParagraphs();
Text text1 = new Text(sec1, “page $p of $P #$NL #$NP hello world”);
paragraphs.add(text1);


Thanks for your help
vland

Hi,

I will check with the developers to see if these symbols have been supported in java.

Thanks.

This feature is not supported. I have logged it as PDFJAVA-5047 but I am afraid we can’t support it in short time.

Is there any workaround to make a new line?

This is my try for a new line it worked but its not nice.
Code:

Section sec1 = pdf1.getSections().add();
Paragraphs paragraphs = sec1.getParagraphs();
Text text1 = new Text(sec1, “mytext here”);
paragraphs.add(text1);

// Hack for new line.
Text text2 = new Text(sec1, " ");
paragraphs.add(text2);

Text text3 = new Text(sec1, “after new line”);

paragraphs.add(text3);


Thanks for Help
vland

Hi,
You can get a new line by two means:

  1. Text text1 = new Text(sec1, “mytext here\n”); or
  2. Text text1 = new Text(sec1, “mytext here#$NL”).
As to "http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/symbols-list-and-purpose.html"
we only support #$NL and #$TAB in java version at present and we will support others in future release.Thank you for considering our product.