wxPdfDoc internal links with WriteXml  [SOLVED]

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

wxPdfDoc internal links with WriteXml

Postby xaviou » Fri Aug 25, 2017 9:20 am

Hi.

I'm currently using wxPdfDocument (last git commit).
One of the document I generate is a list of people :
  • the first page(s) contains the summary : a simple list created with a table using WriteXml()
  • the following pages are details of each person (one per page) created with "classic" Cell() calls

I'd like to create internal links between each summary's item and its corresponding page.

I saw that the understood markup language includes <a name="anchor">...</a> for internal links, but I don't know how to affect this anchor name for a given page (I saw the SetLink() function, but I'm not sure that the anchor will just be the id passed to it).

Is there a simple way to achieve this, or do I have to replace the WriteXml() used for the summary by Cell() calls ?

Regards

Xav'
My wxWidgets stuff web page : X@v's wxStuff

utelle
Moderator
Moderator
Posts: 758
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDoc internal links with WriteXml  [SOLVED]

Postby utelle » Fri Aug 25, 2017 10:14 pm

xaviou wrote:I'm currently using wxPdfDocument (last git commit).
One of the document I generate is a list of people :
  • the first page(s) contains the summary : a simple list created with a table using WriteXml()
  • the following pages are details of each person (one per page) created with "classic" Cell() calls

I'd like to create internal links between each summary's item and its corresponding page.

I saw that the understood markup language includes <a name="anchor">...</a> for internal links, but I don't know how to affect this anchor name for a given page (I saw the SetLink() function, but I'm not sure that the anchor will just be the id passed to it).

Is there a simple way to achieve this, or do I have to replace the WriteXml() used for the summary by Cell() calls ?

You don't have to replace WriteXml() by Cell() calls. Just as in HTML you have to specify an anchor for the location you want to jump to from another place in the document and a hyperlink reference at the location where you want to enable a jump to the details page. This technique is demonstrated in one of the samples (xmlwrite.cpp) coming with wxPdfDocument.

That is, use <a name="anchor">...</a> at the top of the details page for a person using a unique anchor name for each person, and use <a href="#anchor">Details</a> in the summary to insert a link to the details page of a person.

Regards,

Ulrich

User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxPdfDoc internal links with WriteXml

Postby xaviou » Sun Aug 27, 2017 7:28 am

Hi.

Thank-you for your response utelle.

I did not think of the fact I could write the name of the html anchor in top of each page with WriteXml and then creating the rest of the page with Cell() calls.

Sometimes, things are so simple....

Regards.

Xav'
My wxWidgets stuff web page : X@v's wxStuff


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 1 guest