Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon May 25, 2015 8:29 am

Hi,

I need to create a bookmark in a existing file in a specific page.

How can I do it?

Thanks.

Galder

inyazar
 
Posts: 24
Joined: Wed Jul 03, 2013 8:38 am

Mon May 25, 2015 9:23 am

Hello,

Thank you for your inquiry.
There is a tutorial in our website.
http://www.e-iceblue.com/Knowledgebase/ ... B.NET.html
If there are any questions, welcome to get it back to us.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Mon May 25, 2015 9:34 am

Hi,

I already see it, but in this case the document is created on the fly.
I need to know if is it posible to create bookmark in a 'existing file'

Thanks.

Best Regards,
Galder

inyazar
 
Posts: 24
Joined: Wed Jul 03, 2013 8:38 am

Tue May 26, 2015 7:22 am

Hello,

Thanks for your reply.
Please refer to the below code.
Code: Select all
PdfDocument pdf = new PdfDocument("d:\\pdf_test.pdf");
            PdfTextFind[] result = null;
            string bookmark = "Performance Reduced";
            foreach (PdfPageBase page in pdf.Pages)
            {
                result = page.FindText(bookmark).Finds;
                foreach  (PdfTextFind find in result)
                {
                    float y = find.Position.Y;                   
                    PdfDestination vendorBookmarkDest = new PdfDestination(page, new PointF(0, y));
                    PdfBookmark vendorBookmark = pdf.Bookmarks.Add(bookmark);
                    vendorBookmark.Color = Color.SaddleBrown;
                    vendorBookmark.DisplayStyle = PdfTextStyle.Bold;
                    vendorBookmark.Action = new PdfGoToAction(vendorBookmarkDest);
                }
            }
            pdf.SaveToFile("result.pdf");


Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Wed May 27, 2015 8:06 am

Hi,

Thanks a lot.
I'll try it.

Best regards.

inyazar
 
Posts: 24
Joined: Wed Jul 03, 2013 8:38 am

Thu May 28, 2015 1:34 am

Hello,

Thanks for your reply.
If there are any questions, welcome to get it back to us.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF