Error in Aspose.Pdf.Facades.PdfBookmarkEditor.ExportBookmarksToXML

Hi,

We’ve been using PdfBookmarkEditor.ExportBookmarkToXml with previous Aspose.Pdf.Kit package without any problems. After you released Aspose.Pdf, we updated our code to use the latest dll and we have some errors on PdfBookmarkEditor.ExportBookmarkToXml for different pdf files.

You can find attached only 2 pdf files used for testing (I was unable to upload input1.pdf):
- input1.pdf works fine
- input2.pdf has the following exception: Can’t create destination becase of invalid original data
- input3.pdf has the following exception: Object reference not set to an instance of an object.

In our project we are using some custom generated pdf files and have also this error: Object reference not set to an instance of an object. when the ExportBookmarkToXml is called.

Since I was unable to upload the test project I’ll put here the code that you need to paste in a console application in order to reproduce this issue:

class Program
{
static void Main(string[] args)
{
try
{
string inputFileName = “input3.pdf”;
            <span style="color:green;">//ExportBookmarksWithPdfKit(inputFileName);</span>
            ExportBookmarksWithPdfFacades(inputFileName);
        }
        <span style="color:blue;">catch</span> (<span style="color:#2b91af;">Exception</span> ex)
        {
            <span style="color:#2b91af;">Console</span>.WriteLine(ex.Message);
        }
    }

    <span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:blue;">void</span> ExportBookmarksWithPdfKit(<span style="color:blue;">string</span> inputFileName)
    {
        <span style="color:green;">//set the Aspose.Pdf license using the Aspose.Pdf.Kit one</span>
        <span style="color:green;">//Aspose.Pdf.Kit.License asposePdfLicense = new Aspose.Pdf.Kit.License();</span>
        <span style="color:green;">//asposePdfLicense.SetLicense("AsposePdf.Licenses.Aspose.Pdf.Kit.lic");</span>

        <span style="color:green;">//create PdfBookmarkEditor object</span>
        Aspose.Pdf.Kit.<span style="color:#2b91af;">PdfBookmarkEditor</span> bookmarkEditor = <span style="color:blue;">new</span> Aspose.Pdf.Kit.<span style="color:#2b91af;">PdfBookmarkEditor</span>();

        <span style="color:green;">//open PDF file</span>
        bookmarkEditor.BindPdf(inputFileName);

        <span style="color:green;">//export bookmarks</span>
        bookmarkEditor.ExportBookmarksToXML(<span style="color:#a31515;">"bookmarks.xml"</span>);
    }

    <span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:blue;">void</span> ExportBookmarksWithPdfFacades(<span style="color:blue;">string</span> inputFileName)
    {
        <span style="color:green;">//set the Aspose.Pdf license using the Aspose.Pdf.Kit one</span>
        <span style="color:green;">//Aspose.Pdf.License asposePdfLicense = new Aspose.Pdf.License();</span>
        <span style="color:green;">//asposePdfLicense.SetLicense("AsposePdf.Licenses.Aspose.Pdf.Kit.lic");</span>

        <span style="color:green;">//create PdfBookmarkEditor object</span>
        Aspose.Pdf.Facades.<span style="color:#2b91af;">PdfBookmarkEditor</span> bookmarkEditor = <span style="color:blue;">new</span> Aspose.Pdf.Facades.<span style="color:#2b91af;">PdfBookmarkEditor</span>();

        <span style="color:green;">//open PDF file</span>
        bookmarkEditor.BindPdf(inputFileName);

        <span style="color:green;">//export bookmarks</span>
        bookmarkEditor.ExportBookmarksToXML(<span style="color:#a31515;">"bookmarks.xml"</span>);
    }
}</pre>Just add the pdf files to bin/Debug folder and run the application.<br><br>Can you please let me know if there is some work around to these exceptions?<br><br>Thanks,<br><br>Mirela<br>

Hi Mirela,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template files and sample code.

We have found your mentioned issues after initial testing. Your issues are logged in our issue tracking system with issue id: PDFNEWNET-30735 and PDFNEWNET-30737. You will be notified via this forum thread regarding any update against your issue.

Sorry for the inconvenience,

The issues you have found earlier (filed as 30735 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan