Can you post this to the mailing list instead of to the admin?
On Mar 15, 2012 2:25 PM, "prashant Patil" <prashan...@ext.icicibank.com>
wrote:

> **
>  Dear Admin,
>
> I am developing an exe in *.NET 2.0* for splitting and merging PDF files
> using itextsharp (version *4.1.6.0*).
>
> The logic built is, the original PDF file (having 82 pages) is split into
> multiple files (50 pages per file, i.e., 1st file with 50 pages + 2nd file
> with 32 pages).
> Finally both the splitted files are merged into a new PDF file.
>
> I am getting the following issue after merging:
> If the original PDF file (with 82 pages) contains the bookmarks with the
> hyperlinks to pages, the hyperlinks (which are redirecting/linked up to 50
> pages) are preserved but; the remaining hyperlinks (which are
> redirecting/linked above 50 pages, i.e., 51 to 82 pages) are not
> working after merging.
>
> The code is given below for your reference. I have already referred your
> book "IText in Action - Second Edition".
>
> Kindly provide the solution so that all the bookmarks/links are preserved
> after merging.
>
>
> public bool MergePdfFiles(string outputPdf, string[] sourcePdfs)
>
> {
>
> bool result = false;
>
> PdfReader reader = null;
>
> Document document = new Document();
>
> PdfImportedPage page = null;
>
> PdfCopy pdfCpy = null;
>
> int n = 0;
>
> int totalPages = 0;
>
> int page_offset = 0;
>
> ArrayList tempBookmarks = new ArrayList();
>
> ArrayList bookmarks = new ArrayList();
>
> if (sourcePdfs.Length > 1)
>
> {
>
> try
>
> {
>
> for (int i = 0; i <= sourcePdfs.GetUpperBound(0); i++)
>
> {
>
> reader = new PdfReader(sourcePdfs[i]);
>
> reader.ConsolidateNamedDestinations();
>
> n = reader.NumberOfPages;
>
> tempBookmarks = SimpleBookmark.GetBookmark(reader);
>
> if (i == 0)
>
> {
>
> document = new iTextSharp.text.Document
> (reader.GetPageSizeWithRotation(1));
>
> pdfCpy = new PdfCopy(document, new FileStream(outputPdf, FileMode
> .Create));
>
> document.Open();
>
> SimpleBookmark.ShiftPageNumbers(tempBookmarks, page_offset, null);
>
> bookmarks.Add(tempBookmarks);
>
> totalPages = n;
>
> }
>
> else
>
> {
>
> SimpleBookmark.ShiftPageNumbers(tempBookmarks, page_offset, null);
>
> bookmarks.Add(tempBookmarks);
>
> totalPages += n;
>
> }
>
> for (int j = 1; j <= n; j++)
>
> {
>
> page = pdfCpy.GetImportedPage(reader, j);
>
> pdfCpy.AddPage(page);
>
> }
>
> reader.Close();
>
> }
>
> pdfCpy.Outlines = tempBookmarks;
>
> document.Close();
>
> result = true;
>
> }
>
> catch (Exception ex)
>
> {
>
> throw new ApplicationException(ex.Message, ex);
>
> }
>
> }
>
> return result;
>
> }
>
>
>
> *Thanks & Regards,
>
> Prashant Patil, Senior Software Engineer, Software ICICI-SA, 3i Infotech
> Ltd.*
> *Tel.Direct: + 91 22 3981 4585 | Email: prashan...@ext.icicibank.com |
> www.3i-infotech.com*
>
>   "Print this mail only if absolutely necessary. Save Paper. Save Trees."
>
> "This e-mail message may contain confidential, proprietary or legally
> privileged information. It should not be used by anyone who is not the
> original intended recipient. If you have erroneously received this message,
> please delete it immediately and notify the sender. The recipient
> acknowledges that ICICI Bank or its subsidiaries and associated companies,
> (collectively "ICICI Group"), are unable to exercise control or ensure or
> guarantee the integrity of/over the contents of the information contained
> in e-mail transmissions and further acknowledges that any views expressed
> in this message are those of the individual sender and no binding nature of
> the message shall be implied or assumed unless the sender does so expressly
> with due authority of ICICI Group. Before opening any attachments please
> check them for viruses and defects."
>

<<horoline.jpg>>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to