PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

I need add bookmarks based on coordinates(x,y, width,height)
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4434
Page 1 of 1

Author:  Manish [ Tue May 02, 2023 4:54 am ]
Post subject:  I need add bookmarks based on coordinates(x,y, width,height)

COA: As we are having the existing pdf, we need add the bookmarks and highlight the specific word in the page when clicked on bookmark.
Here I tried with this code
gfx = XGraphics.FromPdfPage(pages[idx]);


string destText = "DestPage" + idx;

gfx.DrawString("hello", font, XBrushes.Black, new XRect(0, 0, pages[idx].Width, pages[idx].Height), XStringFormats.BottomLeft);

gfx.DrawRectangle(XPens.Aquamarine, new XRect(0, 0.20, 200, 100));

var bookMark = outline.Outlines.Add(destText, pages[idx], true);
bookMark.DestinationPage = pages[idx];

But In this, let's have input of bookmarkName and bookMarkValue, here
    when I click on the bookmark it should go to the specific bookmarkValue destination

As of now when I click on the bookmark ==> goto ==> specific page(not for specific content/word(bookmarkValue), which is present in the page)
As I need this functionality, could you please help me with this

Author:  TH-Soft [ Tue May 02, 2023 7:43 am ]
Post subject:  Re: I need add bookmarks based on coordinates(x,y, width,hei

Are you trying to add a document link (hyperlink) to your document? Hyperlinks are one thing, bookmarks are a different thing.

Author:  Manish [ Thu May 04, 2023 8:40 am ]
Post subject:  Re: I need add bookmarks based on coordinates(x,y, width,hei

Hi,
Thanks for the reply
No I'm not trying for hyperlinks.

My only functionality I need is
=> I will add the bookmark to the specific page(page numbers)
=> If I added the bookmark in page 3 ==> when I click on it ==> it will redirect to the specific page

==> what I need is ==> when I click on bookmark ==> is there any possibility to goto specific highlighted content (I mean text/word or it can be specific line) by using coordinates???

Author:  TH-Soft [ Thu May 04, 2023 8:48 am ]
Post subject:  Re: I need add bookmarks based on coordinates(x,y, width,hei

Manish wrote:
==> what I need is ==> when I click on bookmark ==> is there any possibility to goto specific highlighted content (I mean text/word or it can be specific line) by using coordinates???
AFAIK bookmarks in PDF can jump to a specific Y position on a specific page. I'm not aware of also jumping to an X position or highlighting specific areas.
IIRC MigraDoc does not yet support setting the Y position for bookmarks.

It should be possible to set the Y position with PDFsharp.

Author:  Manish [ Fri May 05, 2023 4:16 am ]
Post subject:  Re: I need add bookmarks based on coordinates(x,y, width,hei

Hi Thomas,
You have mentioned
Quote:
It should be possible to set the Y position with PDFsharp.


Could you please give me some insights/documentation/code on how to set to y position??

Thanks

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/