I currently evaluate the possibility to use PDFClown for the merging of two PDFs.
If I'm not mistaken the supposed way to do so is using PageManager.Add( Document );
Unfortunately this method ignores all annotations on purpose to avoid running into circular references. But that is what I like to accomplish. The resulting PDF should contain both set of pages including valid links and bookmarks.
First question: Is this functionality already present and I just didn't find it?
To achieve this goal I changed the way how PageManager handles "importedObjects" to avoid the circular references problem. Additionally I need to include the named locations of the second PDF into the first one. That works surprisingly well as long as the Link annotations contain a named destination or an action containing a named destination. It (still) fails when the destination is given implicitly.
Those reference 53 0 R is correctly transformed to reference the added page but still the link in the document jumps to the exact same page (number wise) as in the original document.
To make the above sentence more clear:
PDF1: 70 pages
PDF2: 14 pages (actually it is your 'whyOpenSourceMakeSense.pdf')
Attaching PDF2 at the end of PDF1 transforms the link destinations of PDF2 but the links on original page 3 and transformed page 73 still jump to page 14.
Second Question: Am I missing something?
Third Question: As I plan to contribute that code to the project (as soon as it works smoothly): Is the PageManager to ideal location to add this functionality? Or would it be more "in line" with your concept to create an additional tool which utilizes PageManager?
Finally I have two little bugs to report:
1.) Destination.cs:240 - I do get an exception that this can't be casted implicitly. I currently cast the output of GetValue to double and then cast it to float when creating the PointF.
2.) NameTree.cs:423 - An >= removes an IndexOutOfBoundsException if the leaf node is empty. I'm not sure if this wouldn't be an error case anyway.
I'm posting the bugs (and my fixes) here, because I'm unaware of any side effects those changes may have. Nevertheless they work fine in my single testcase.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.