This is a migrated thread and some comments may be shown as answers.

Bookmark

2 Answers 270 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Paulo Goncalves
Top achievements
Rank 2
Paulo Goncalves asked on 23 May 2016, 09:30 PM

Can I add Bookmarks at PDF page ? How ?

 

Thanks

2 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 25 May 2016, 06:43 AM
Hi Paulo,

You could use the Annotations and Destinations functionality to achieve a similar result. The snippet below shows how you can add a link at the top-left corner of the first page which will scroll the document to the second page:

Location location = new Location();
location.Left = 0;
location.Top = 0;
location.Page = document.Pages[1];
  
var link = document.Pages[0].Annotations.AddLink(location);
link.Rect = new Rect(10, 10, 50, 50);

Note, however, that at this point the RadFixedDocumentEditor doesn't expose convenient API that will allow you to find where a specific element (text fragment) is positioned. You could take a look at the Block article for an alternative approach to creating documents which will allow to measure each block and obtain its size for the purposes of creating the link's rectangle.

I hope this helps.

Regards,
Tanya
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Suren
Top achievements
Rank 1
commented on 21 Jul 2021, 07:30 AM

HI , do you have any C# sample code(fully) ? if yes please send me too.. i need to combine few pdf document and create index page. when clicking the index page then need to focus to relevant page.
Suren
Top achievements
Rank 1
commented on 21 Jul 2021, 07:36 AM

PdfFormatProvider provider = new PdfFormatProvider();

PdfImportSettings importSettings = new PdfImportSettings
{
CopyStream = true
};

provider.ImportSettings = importSettings;

var inputSteam = File.OpenRead("D:\\DPS\\Bundling - V3\\TestFile\\out\\out.pdf");

RadFixedDocument document = provider.Import(inputSteam);

Location location = new Location();
location.Left = 0;
location.Top = 0;
location.Zoom = 4;
location.Page = document.Pages[1];

var link = document.Pages[0].Annotations.AddLink(location);
link.Rect = new Rect(10, 10, 50, 50);
0
Martin
Telerik team
answered on 22 Jul 2021, 10:06 AM

Hello Suren,

A sample example of how to create a Table of Contents (TOC) page with links leading to the relevant pages could be found in the following feature request: PdfProcessing: Provide API for inserting Table of Contents (TOC).

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PdfProcessing
Asked by
Paulo Goncalves
Top achievements
Rank 2
Answers by
Tanya
Telerik team
Martin
Telerik team
Share this question
or