|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
As expected, when I create a bookmark within a HtmlToPdfResult, then to a PdfDocument, then finally merge with another PdfDocument everything works fine (the parent PdfDocument understands and merges the Bookmark).
If I create an anchor link to that bookmark within the html (and within the same original PDF document) everything is fine.
However, if I create an anchor link within a separate PdfDocument that I merge, it does not work. Is it possible to link to bookmarks from PdfDocuments that are merged?
Thanks.
|
|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
The main issue is that I need to create include a number of different styles for pages within a single PdfDocument. Title page has a white background and no footer, Chapter dividers have another background color and no footer, Then the rest has yet another background color and does have the footer.
To achieve this, I create a number of PdfDocuments and merge them together at the end.
It works great visually, but I dont seem to be able to link between them. Ideally, I'd like to be able to make the PDF highly interactive with bookmarks and a href links that target those bookmarks through out the merged pdf.
Thanks for your help on this!
|
|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
Alternatively, I could create the Pdf as a single document in the first place. Is there a way of detecting (and intercepting) the page that's being rendered? If somehow during On_BeforeRenderPage I could detect something from the page like an h1 tag value?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
|
|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
I believe that's the one I'm using. I've included a couple of snippets below to demonstrate (this is not the full code) I initially set:
Code:
List<HtmlToPdfResult> results = new List<HtmlToPdfResult>();
In a loop, I do:
Code: C#
PdfDocument pdfDocument = new PdfDocument();
HtmlToPdfResult contentResult = EO.Pdf.HtmlToPdf.ConvertHtml(html, pdfDocument, htmlToPdfOptions);
results.Add(contentResult);
Then afterwards,
Code: C#
PdfDocument pdfDocument = PdfDocument.Merge(results.ToArray());
However, any links between Pdf's that get merged do not work.
|
|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
By the way - just in case this is the problem - here's how the links look: The link in the 2nd HtmlToPdfResult
Code: HTML/ASPX
<a class="" href="#SectionAppendixChapterDividerPage"><span>Appendix</span></a>
The destination in the 1st HtmlToPdfResult
Code: HTML/ASPX
<div id="SectionAppendixChapterDividerPage" name="SectionAppendixChapterDividerPage" class="chapter_title" style="visibility:hidden;">Appendix</div>
The 2 HtmlToPdfResult's are merged, but the link does not work. If the link and destination are in the same HtmlToPdfResult, then it works after it is merged. Thanks.
|
|
Rank: Advanced Member Groups: Member
Joined: 6/13/2012 Posts: 55
|
When I created a separate test application I was able to get this working. So, I'll track down what's causing the issue in the bigger one. Thx for your help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Thanks for the update. We were indeed having trouble reproducing this problem. If you manage to isolate and reproduce it, please send it over and we will be happy to investigate further.
|
|