0

I am working on the Bookmark Export Task which exporting all the bookmark from one pdf to another pdf. Which is working fine for me now but the Bookmark Properties like Zoom in/zoom out/page navigation actions are not working.

Please find my code below and guide me in my approach to my task.

Console C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iTextSharp.text.pdf;
using iTextSharp.text;
 class BookMark
    {
        static void Main(string[] args)
        {
            string source = "D:\\Sourcefile.pdf";
            string destination = "D:\\Outputfile.pdf";
            string temp_destination = dest.Replace(".", "_temp.");
            File.Copy(destination, temp_destination);
            PdfReader reader = new PdfReader(src);
            List<Dictionary<String, Object>> list = SimpleBookmark.GetBookmark(reader).ToList();
            reader.Close();
            PdfReader reader1 = new PdfReader(temp_destination);
            PdfStamper stamper = new PdfStamper(reader1, new FileStream(dest, FileMode.Create));
            stamper.Outlines = list;
            stamper.Close();
            reader1.Close();
            File.Delete(temp_destination);
        }
    }

When I run the above program I will get all the pdf bookmarks from Sourcefile.pdf to Outputfile.pdf, but action of the bookmarks like page down, page up, zoom in, zoom out ..etc actions are not working properly (when I checked its property the action are none) in exported pdf.

Kindly see the source file (screenshot attached) bookmark action property and destination (screenshot attached) bookmark action property.

Source File Bookmark Action Property

enter image description here

Source File Bookmark Lists and destination bookmark list will look the same list as Source File

enter image description here

Destination File Bookmark Action Property with no action imported from source Bookmark

enter image description here

Samuel Huylebroeck
  • 1,639
  • 11
  • 15
Nachiappan R
  • 182
  • 1
  • 1
  • 20

0 Answers0