You must Sign In to post a response.
  • Category: ASP.NET

    How to Import Bookmark from xml to existing pdf?

    I am currently working on pdf projects (dotnet/c#[Itextsharp pdf]), I want to export and import bookmarks from one pdf to another pdf (both pdf are having same content, only difference are with bookmark/without bookmark and one is normal pdf and another linked pdf). Exporting bookmarks to xml is working fine but I don`t have the idea of importing exported bookmark(xml) to another pdf. Can any body suggest solution.

    Here I am attaching my code.

    <code>

    string inputpdf = "D:\\chapter1.pdf"; string outputbookmark="D:\\chapter1Bookmark.xml";
    PdfReader reader = new PdfReader(inputpdf);
    IList<Dictionary<string, object>> bookmarks = SimpleBookmark.GetBookmark(reader);
    using (StreamWriter Sw = new StreamWriter(outputbookmark))
    {
    SimpleBookmark.ExportToXML(bookmarks, Sw,"ISO8859-1", true);

    }
    reader.Close();
    </code>
  • #766741
    Hi,

    I never worked on such scenario, but as per my understanding I give you one suggestion, as you said you can export controls to pdf is working fine but you are struggling to export one pdf to another pdf, my suggestion is rather than export one pdf to another simply export pdf to some control ex gridview and from that control to again export to pdf.

    I'm not sure whether it works in your case, but I just give you some suggestion.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766745
    No, Naveen you are misunderstood. I can export bookmark from pdf and struggling for to import the bookmark to pdf.

  • #766751
    I haven't tried this ever, but I guess merging both pdf will help to add the bookmark in merged pdf. Just look at the sample code below and see if it helps.
    http://www.vbforums.com/showthread.php?475920.html


    Regards,
    Asheej T K

  • #766753
    I don`t need to combine pdf or bookmarks. I need to import the bookmark to existing pdf which does not have bookmark.

  • #766774
    But I don`t need to merge pdf, my only need to import the bookmark (Which is stored in xml) to another pdf.

  • #766784

    PDF bookmarks are actually a area in pdf file where are jump in, do you have a area co-ordinates in XML to set them in PDF, I think first you need make a demo to create a bookmark in pdf, here are some good links that you can work on
    http://www.mikesdotnetting.com/article/84/itextsharp-links-and-bookmarks
    http://stackoverflow.com/questions/20702728/add-page-bookmarks-to-an-existing-pdf-using-itextsharp-using-c-sharp-code


    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766875
    Please refer once tesaract ocr you may get the desired result and for that matter PDF readers too. Please check once with Tesaract Optical character Recognition.
    SRI RAMA PHANI BHUSHAN KAMBHAMPATI

  • #766900
    Thanks prasad, I will try your solution. Actually In xml files contains position of the text and bookmark details only. Lets I try your suggest and get back if I face any issue.

  • #767172
    check these links

    http://stackoverflow.com/questions/37993783/how-to-import-bookmark-from-xml-to-existing-pdf
    http://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/PDF-Bookmark-Add-PDF-Bookmark-in-C-VB.NET.html


  • Sign In to post your comments