Hello! There is such a task:
There are two PDF documents. Both consist of 197 pages. The first document on 1-2 pages has links to the rest (3-197) pages of this document. We need to combine these two documents as follows:
1 and 2 pages - from the first document (with working links; links should be sent to the appropriate pages of the new merged document);
3-197 pages - from the second document.
Association do as follows:
Doc:= New iTextSharp.text.Document(); ReaderDoc1:=New iTextSharp.text.pdf.PdfReader(FileName1); ReaderDoc2:=New iTextSharp.text.pdf.PdfReader(FileName2); FStream:=New System.IO.FileStream(OutFileName, System.IO.FileMode.CreateNew); Writer := New iTextSharp.text.pdf.PdfCopy(Doc, FStream); Doc.Open(); Writer.AddPage(Writer.GetImportedPage(ReaderDoc1,1)); Writer.AddPage(Writer.GetImportedPage(ReaderDoc1,2)); PageCount := ReaderDoc2.NumberOfPages; For f := 3 To PageCount Do Writer.AddPage(Writer.GetImportedPage(ReaderDoc2, f)); End For;
As a result, links stop working.
Tell me how to keep the links working. Thanks for the help!