Hi Anand,
Thanks for sharing the details.
In order to create a link in PDF file, we need to specify
the location where link needs to be displayed. We use Rectangle object to
specify the location where the link needs to be displayed. However as a workaround,
you may consider specifying the border color for Rectangle object as white or
equal to current document location and the Rectangle will not be visible in
updated PDF file.
<o:p></o:p>
Concerning to your query on adding blank page in
concatenated PDF file to accommodate TOC hyperlinks, you can programmatically
get an idea about the number of links that can be placed over a page and in
case the number of links are in large number which cannot be accommodated over
single page, multiple pages can be placed/inserted at the beginning of
document. We are sorry for your inconvenience.
Please take a look over following code snippet in which I
have placed a Rectangle with white border color.
[Java]
// create Pdf Content Editor object
com.aspose.pdf.kit.PdfContentEditor editor = new com.aspose.pdf.kit.PdfContentEditor();
// create rectangle object which will
indicate the location where link needs to be added
Rectangle rect = new
Rectangle(130, 130, 150, 150);
// specify action for linnk.
String[] actionName = {
MenuActionName.DOCUMENT_ATTACHFILE, MenuActionName.DOCUMENT_EXTRACTPAGES };
// set color object as white
Color clr = new Color(255, 255, 255);
// path of output file
String outputFile = "d:/output_Linked.pdf";
// bind the souce PDF file
editor.bindPdf("d:/Input.pdf");
try
{
// create a local link pointing to
first page of PDF file
editor.createLocalLink(rect, 2, 1, clr,
actionName);
// Create a free text which shows the
link to page 1 of File.
// Origin are similar to create local
link
editor.createFreeText(rect, "Link to Page 2", 2);
// save updated PDF file
editor.save(outputFile);
}
catch (Exception e)
{
e.printStackTrace();
}