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

Free Support Forum - aspose.com

Link Border and Alignment Errors

Hello,


My company has purchased an Aspose Java licence which is valid for Aspose 4.3 but not for the latest Version.

I noticed two bug with our purchased version while trying to create a table of content using XSL/FO syntax. The main bug concern the creation of annotation link over text.

1 - Border is persistent on Links ( Page 3)

This code is not working for the old version!

LinkAnnotation link2 = new LinkAnnotation(pdf.getPages().get_Item(pageNumber), link.getRect());
Border myBorder = new Border(link2);
myBorder.setWidth(0);
link2.setBorder(myBorder);

Border is still here after this code

2 - Page numbers text has a large space between characters (Page 4-…)

See the attached PDF document

As we purchased only the older version, is it possible to have the bug correction for this two points?

You’ll find the generated PDF documents in this thread.


Regards,

Mohammad

vdoc:
I noticed two bug with our purchased version while trying to create a table of content using XSL/FO syntax. The main bug concern the creation of annotation link over text.

1 - Border is persistent on Links ( Page 3)

This code is not working for the old version!

LinkAnnotation link2 = new LinkAnnotation(pdf.getPages().get_Item(pageNumber), link.getRect());
Border myBorder = new Border(link2);
myBorder.setWidth(0);
link2.setBorder(myBorder);

Border is still here after this code

2 - Page numbers text has a large space between characters (Page 4-..)

See the attached PDF document
Hi Mohammad,

Thanks for contacting support.

Can you please share the resource XSL-FO and complete code snippet which you are using so that we can test the scenario at our end. We are sorry for this inconvenience.

Hello,

I think that I was not so clear with my last message actually I don't have a problem on using XSL/FO, the problem occurs on post-processing and I can produce it on a new generated document without even using XSL/FO!

You can make a test on empty document even using this code snippet:

LinkAnnotation link2 = new LinkAnnotation(pdf.getPages().get_Item(pageNumber), link.getRect()); //// REPLACE link.getRect() by any values!
Border myBorder = new Border(link2);
myBorder.setWidth(0);
link2.setBorder(myBorder);


The bug with Aspose PDF 4.3 is that myBorder.setWidth(0); is not working at all, and after I add the annotation to the document I still have a Visible Border.

The second problem is not related neither to XSL/FO. I use TextStamps to print the text and I have as a result the page number with a lot of gap between characters. Check PDF!

Thanks for support.

Mohammad

vdoc:
I think that I was not so clear with my last message actually I don’t have a problem on using XSL/FO, the problem occurs on post-processing and I can produce it on a new generated document without even using XSL/FO!

You can make a test on empty document even using this code snippet:

LinkAnnotation link2 = new LinkAnnotation(pdf.getPages().get_Item(pageNumber), link.getRect()); //// REPLACE link.getRect() by any values!
Border myBorder = new Border(link2);
myBorder.setWidth(0);
link2.setBorder(myBorder);


The bug with Aspose PDF 4.3 is that myBorder.setWidth(0); is not working at all, and after I add the annotation to the document I still have a Visible Border.
Hi Mohammad,

Thanks for sharing the details.

I have tested the scenario using latest release of Aspose.Pdf for Java 9.3.0 where I have used following code snippet and as per my observations, no border is appearing against link object. Can you please try using the latest release and in case the issue still persists, please share the complete code which can help us in replicating this problem.

[Java]

Document pdfDocument = new Document();<o:p></o:p>

pdfDocument.getPages().add();

LinkAnnotation link2 = new com.aspose.pdf.LinkAnnotation(pdfDocument.getPages().get_Item(1), new com.aspose.pdf.Rectangle(100, 100, 140, 120)); //// REPLACE link.getRect() by any values!

link2.setContents("sample link");

Border myBorder = new Border(link2);

myBorder.setWidth(0);

link2.setBorder(myBorder);

pdfDocument.getPages().get_Item(1).getAnnotations().add(link2);

//save updated document

pdfDocument.save("c:/pdftest/LinkAnnotation_output.pdf");


vdoc:
The second problem is not related neither to XSL/FO. I use TextStamps to print the text and I have as a result the page number with a lot of gap between characters. Check PDF!
I have tested the scenario using following code snippet and as per my observations, the page number information is properly being displayed. For your reference, I have also attached the resultant PDF generated over my end.

[Java]

Document pdfDocument = new Document();

pdfDocument.getPages().add();

//create page number stamp

com.aspose.pdf.PageNumberStamp pageNumberStamp = new com.aspose.pdf.PageNumberStamp();

//whether the stamp is background

pageNumberStamp.setBackground(false);

pageNumberStamp.setFormat("Page # of " + pdfDocument.getPages().size());

pageNumberStamp.setBottomMargin(10);

pageNumberStamp.setHorizontalAlignment(com.aspose.pdf.HorizontalAlignment.Center);

pageNumberStamp.setStartingNumber(1);

//set text properties

pageNumberStamp.getTextState().setFont(com.aspose.pdf.FontRepository.findFont("Arial"));

pageNumberStamp.getTextState().setFontSize(14.0F);

pageNumberStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);

pageNumberStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);

pageNumberStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getBlue());

//add stamp to particular page

pdfDocument.getPages().get_Item(1).addStamp(pageNumberStamp);

//save updated document

pdfDocument.save("c:/pdftest/PageNumber_output.pdf");