PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:01 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue May 02, 2023 4:54 am 
Offline

Joined: Tue May 02, 2023 4:44 am
Posts: 3
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


Top
 Profile  
Reply with quote  
PostPosted: Tue May 02, 2023 7:43 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Are you trying to add a document link (hyperlink) to your document? Hyperlinks are one thing, bookmarks are a different thing.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu May 04, 2023 8:40 am 
Offline

Joined: Tue May 02, 2023 4:44 am
Posts: 3
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???


Top
 Profile  
Reply with quote  
PostPosted: Thu May 04, 2023 8:48 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
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.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Fri May 05, 2023 4:16 am 
Offline

Joined: Tue May 02, 2023 4:44 am
Posts: 3
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 135 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group