Welcome Guest Search | Active Topics | Sign In | Register

Linking between multiple PDF documents Options
vmykhalchuk
Posted: Thursday, September 26, 2019 6:26:51 AM
Rank: Member
Groups: Member

Joined: 3/6/2019
Posts: 12
Hello,

Currently we are facing issues generating very large PDF documents from HTML templates (over 10 and more thousand pages) due to memory usage, so we are looking into an option to logically split one document into multiple files.
However very important part of our functionality is linking between different data items within the document, and in case of splitting there weill be a need to add links between the different sections of different PDFs, including cross links (links both from document A to document B, and back from B to A)

Skimming through the documentation did not show any options to add links from one PDF file to another though, apart from opening it as a generic file on the first page.

So the question is are there any plans to create a functionality to:
1. Allow opening destinations from another files (GoToR action, as per PDF standard)
2. Support named destinations (from what I see, only explicit destinations are supported by the library at the moment)

Or maybe by any chance this functionality is supported in some form at the moment and we just missed it?

Thank you in advance for your reply!
eo_support
Posted: Thursday, September 26, 2019 2:38:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Currently you can do this through A element. The following code demonstrates the basic flow:

Code: C#
//Convert the first section that contains an A element
//that points to an anchor in the second section
PdfDocument doc1 = new PdfDocument();
HtmlToPdfResult result1 = HtmlToPdf.ConvertHtml("<a href='#target'>Go to target</a>", doc1);

//Convert the second section
PdfDocument doc2 = new PdfDocument();
HtmlToPdfResult result2 = HtmlToPdf.ConvertHtml("<a name ='target'></a>Target", doc1);

//Merge the two sections
PdfDocument resultPdf = PdfDocument.Merge(result1, result2);


The key here is to pass the HtmlToPdfResult objects to PdfDocument.Merge (as opposes to passing PdfDocument objects to be merged). The HtmlToPdfResult object contains link information so when this version of the Merge is used, the links will be correctly fixed up.

Please let us know if this works for you.

Thanks!
vmykhalchuk
Posted: Thursday, September 26, 2019 3:40:30 PM
Rank: Member
Groups: Member

Joined: 3/6/2019
Posts: 12
Hello,

Thanks for your reply! We will try that out tomorrow.

But from lookin at the code snippet my understanding is that the links will work as needed in third pdf only (resultPdf), within one file. Is that correct?
What we need is having two separate PDF files (doc1 and doc2 from the example), which will have the links one to another, without combining them into one document.
eo_support
Posted: Thursday, September 26, 2019 3:46:04 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

The code we provided will not work with third party PDF files. It only works between multiple HtmlToPdfResult objects. You can only get that object from our HTML to PDF converter.

If you want to keep multiple PDF files, you can simply use A element to point to the target PDF file. For example "<a href='doc2.pdf'>doc2</a>".

Thanks
vmykhalchuk
Posted: Thursday, September 26, 2019 4:03:28 PM
Rank: Member
Groups: Member

Joined: 3/6/2019
Posts: 12
All PDF files involved are going to be generated using EO.Pdf, but for resource usage concerns we have to generate separate files one at a time.
PDF standard supports linking between multiple PDF files not only by generic opening the PDF similarly to opening any other file. There is support for Remote GoTo actions (similar to GoTo action, but in separate file) which allows to navigate to the specific page or named destination within another PDF file.
So essentially we need something like <a href='doc2.pdf#page=10'>please find details in doc2</a>, or even <a href='doc2.pdf#nameddestination=Section2'>please find more details indoc2</a>
This is supported in some other pdf libraries, which allow more low level PDF manipulation, but we are interested if this can be done without switching from eo to some other software.
eo_support
Posted: Thursday, September 26, 2019 4:22:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

I can confirm that we do not support remote goto in the current build. We may add it in our future builds if we see more interests on this feature. However as of now we do not have any plan to implement this yet.

Thanks!
vmykhalchuk
Posted: Thursday, September 26, 2019 4:23:44 PM
Rank: Member
Groups: Member

Joined: 3/6/2019
Posts: 12
Got it,

Thank you for your response!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.