|
Rank: Advanced Member Groups: Member
Joined: 8/31/2011 Posts: 34
|
Hello, I use HTML to PDF to print a html report which is several pages long, and is created a piece at a time, on the same document. I read that I can create a a bookemark by getting its contents and using the CreateDestination method.
Code: C#
//Create a PdfBookmark object with text "Chapter 1"
PdfBookmark bookmark = new PdfBookmark("Chapter 1");
//Initializes the bookmark's Destination property
bookmark.Destination = content.CreateDestination();
//Add it as a top level bookmark, "doc"
//is a PdfDocument object
doc.Bookmarks.Add(bookmark);
Since my document is HTML to PDF, how can a set the destination of the bookmarks ? Gratefulfor the help, Fabio
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, The equivalent for that in HTML to PDF is something like this:
Code: C#
//Get the HtmlToPdfResult object
HtmlToPdfResult result = HtmlToPdf.ConvertUrl(.....);
//Get the HtmlElement object. There are several different methods
//on the HtmlDocument for you to get an HtmlElement object. Check
//for the documentation for more details
HtmlElement element = result.HtmlDocument.GetElementById("element_id");
//Create a bookmark pointing to that element
PdfBookmark bookmark = element.CreateBookmark();
Hope this helps. Please feel free to let us know if you have any more questions. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2011 Posts: 34
|
Yup, that did the trick. I'll explore more about the HtmlToPdfResult.
Thanks !
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2011 Posts: 34
|
Hi,
So, I'm trying to format my pdf document to be read on the ipad, and the default viewer doesnt support (at least I couldn't find it) bookmarks. So I thought about doing a a manual index using link tags (<a>) on anchor names.
But when I open my files, I can't (even external links) click on any hyperlink. I'm using adobe reader 9.4.6 and altered the default permission on links, but it still doesn't work.
Any ideias on what I might be doing wrong ?
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
iPad is known to have some issues with PDF files, for example, it would not prompt password for a password protected PDF file. I do not believe you are doing anything wrong here. As long as the file opens and the links work fine on a PC, your PDF file is fine and the problem is on the iPad side. As the name "PDF" suggest, PDF file is "portable", so there is nothing for iPad specifically in term of the file format.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2011 Posts: 34
|
Sorry,
I misexplain myself.
The tests on Adobe Reader I'm running on windows 7 and the links still don't work.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
In that case please try to open the same HTML in a browser and see if the link works. If the link does not work in a browser, then the problem is definitely on your HTML side. If the link does open in the browser but does not open in Adobe Reader, then you can create a small test application to demonstrate the problem and we will be happy to take a look.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2011 Posts: 34
|
I put together a separate solution to send you guys, but in this new solution the links are working fine.
I'm gonna deep digger into my code to see what may be causing the problem. There were any problems related to this solved in the last build ?
Thanks, Fabio
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We are not aware of anything related to links in the last build, but if you are not already on the latest build, I would recommend you to upgrade first. The first thing we do when we have your repro project is to run it on the latest build.
Thanks!
|
|