Aspose::Pdf::Facades::PdfBookmarkEditor Class Referencefinal

Represents a class to work with PDF file's bookmarks including create, modify, export, import and delete. More...

Inherits Aspose::Pdf::Facades::SaveableFacade.

Public Member Functions

void CreateBookmarks ()
 Creates bookmarks for all pages. More...
 
void CreateBookmarkOfPage (System::String bookmarkName, int32_t pageNumber)
 Creates bookmark for the specified page. More...
 
void CreateBookmarks (System::SharedPtr< Bookmark > bookmark)
 Creates the specified bookmark in the document. The method can be used for forming nested bookmarks hierarchy. More...
 
void CreateBookmarks (System::Drawing::Color color, bool boldFlag, bool italicFlag)
 Create bookmarks for all pages with specified color and style (bold, italic). More...
 
void CreateBookmarkOfPage (System::ArrayPtr< System::String > bookmarkName, System::ArrayPtr< int32_t > pageNumber)
 Creates bookmarks for the specified pages. More...
 
void DeleteBookmarks ()
 Deletes all bookmarks of the PDF document. More...
 
void DeleteBookmarks (System::String title)
 Deletes the bookmark of the PDF document. More...
 
void ModifyBookmarks (System::String sTitle, System::String dTitle)
 Modifys bookmark title according to the specified bookmark title. More...
 
System::SharedPtr< BookmarksExtractBookmarks ()
 Extracts bookmarks of all levels from the document. More...
 
System::SharedPtr< BookmarksExtractBookmarks (bool upperLevel)
 Extracts bookmarks of all levels from the document. More...
 
System::SharedPtr< BookmarksExtractBookmarks (System::String title)
 Extracts the bookmarks with the specified title. More...
 
System::SharedPtr< BookmarksExtractBookmarks (System::SharedPtr< Bookmark > bookmark)
 Extracts the children of a bookmark with a title like in specified bookamrk. More...
 
void ExtractBookmarksToHTML (System::String pdfFile, System::String cssFile)
 Exports bookmarks to HTML file. More...
 
void ExportBookmarksToXML (System::String xmlFile)
 Exports bookmarks to XML file. More...
 
void ExportBookmarksToXML (System::SharedPtr< System::IO::Stream > stream)
 Exports bookmarks to XML stream. More...
 
void ImportBookmarksWithXML (System::String xmlFile)
 Imports bookmarks to the document from XML file. More...
 
void ImportBookmarksWithXML (System::SharedPtr< System::IO::Stream > stream)
 Imports bookmarks to the document from XML file. More...
 
 PdfBookmarkEditor ()
 Initializes new PdfBookmarkEditor object. More...
 
 PdfBookmarkEditor (System::SharedPtr< Aspose::Pdf::Document > document)
 Initializes new PdfBookmarkEditor object on base of the document . More...
 
- Public Member Functions inherited from Aspose::Pdf::Facades::SaveableFacade
virtual void Save (System::String destFile)
 Saves the PDF document to the specified file. More...
 
virtual void Save (System::SharedPtr< System::IO::Stream > destStream)
 Saves the PDF document to the specified stream. More...
 
- Public Member Functions inherited from Aspose::Pdf::Facades::Facade
System::SharedPtr< Aspose::Pdf::Documentget_Document () const
 Gets the document facade is working on. More...
 
virtual void BindPdf (System::String srcFile)
 Initializes the facade. More...
 
virtual void BindPdf (System::SharedPtr< System::IO::Stream > srcStream)
 Initializes the facade. More...
 
virtual void BindPdf (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 Initializes the facade. More...
 
virtual void Close ()
 Disposes Aspose.Pdf.Document bound with a facade. More...
 
void Dispose ()
 Disposes the facade. More...
 
- Public Member Functions inherited from Aspose::Pdf::Facades::IFacade
virtual void BindPdf (System::SharedPtr< Document > srcDoc)=0
 Binds PDF document for editing. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared refernce counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () ASPOSE_CONST
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Static Public Member Functions

static void ExportBookmarksToHtml (System::String inPdfFile, System::String outHtmlFile)
 Exports bookmarks to HTML file. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Impleemnts C# typeof(System.Object) construct. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 
- Protected Member Functions inherited from Aspose::Pdf::Facades::SaveableFacade
 SaveableFacade ()
 The constructor. More...
 
 SaveableFacade (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 The constructor. More...
 
- Protected Member Functions inherited from Aspose::Pdf::Facades::Facade
 Facade ()
 The constructor. More...
 
 Facade (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 The constructor. More...
 
virtual void BindPdf (System::String srcFile, System::String password)
 Initializes the facade. More...
 
virtual void BindPdf (System::SharedPtr< System::IO::Stream > srcStream, System::String password)
 Initializes the facade. More...
 
virtual void AssertDocument () const
 Asserts if the facade is initialized. More...
 

Detailed Description

Represents a class to work with PDF file's bookmarks including create, modify, export, import and delete.

Constructor & Destructor Documentation

◆ PdfBookmarkEditor() [1/2]

Aspose::Pdf::Facades::PdfBookmarkEditor::PdfBookmarkEditor ( )

Initializes new PdfBookmarkEditor object.

◆ PdfBookmarkEditor() [2/2]

Aspose::Pdf::Facades::PdfBookmarkEditor::PdfBookmarkEditor ( System::SharedPtr< Aspose::Pdf::Document document)

Initializes new PdfBookmarkEditor object on base of the document .

Parameters
documentPdf document.

Member Function Documentation

◆ CreateBookmarkOfPage() [1/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::CreateBookmarkOfPage ( System::String  bookmarkName,
int32_t  pageNumber 
)

Creates bookmark for the specified page.

Parameters
bookmarkNameThe specified bookmark name.
pageNumberThe specified desination page.
editor.BindPdf("example.pdf");
editor.CreateBookmarkOfPage("bookmark for page 1", 1);
editor.Save("example_out.pdf");

◆ CreateBookmarkOfPage() [2/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::CreateBookmarkOfPage ( System::ArrayPtr< System::String bookmarkName,
System::ArrayPtr< int32_t >  pageNumber 
)

Creates bookmarks for the specified pages.

Parameters
bookmarkNameBookmarks title array.
pageNumberBookmarks desination page array.
editor.BindPdf("example.pdf");
editor.CreateBookmarkOfPage("bookmark for page 1", 1);
editor.Save("example_out.pdf");

◆ CreateBookmarks() [1/3]

void Aspose::Pdf::Facades::PdfBookmarkEditor::CreateBookmarks ( )

Creates bookmarks for all pages.

editor.BindPdf("example.pdf");
editor.CreateBookmarks();
editor.Save("example_out.pdf");

◆ CreateBookmarks() [2/3]

void Aspose::Pdf::Facades::PdfBookmarkEditor::CreateBookmarks ( System::SharedPtr< Bookmark bookmark)

Creates the specified bookmark in the document. The method can be used for forming nested bookmarks hierarchy.

Parameters
bookmarkThe bookmark will be added to the document.
editor.BindPdf("example.pdf");
Bookmark bm1=new Bookmark();
bm1.PageNumber=1;
bm1.Title="First child";
Bookmark bm2=new Bookmark();
bm2.PageNumber=2;
bm2.Title="Second child";
Bookmark bm=new Bookmark();
bm.Action="GoTo";
bm.PageNumber=1;
bm.Title="Parent";
Bookmarks bms=new Bookmarks();
bms.Add(bm1);
bms.Add(bm2);
bm.ChildItem=bms;
editor.CreateBookmarks(bm);
editor.Save("example_out.pdf");

◆ CreateBookmarks() [3/3]

void Aspose::Pdf::Facades::PdfBookmarkEditor::CreateBookmarks ( System::Drawing::Color  color,
bool  boldFlag,
bool  italicFlag 
)

Create bookmarks for all pages with specified color and style (bold, italic).

Parameters
colorThe color of title.
boldFlagThe flag of bold attribution.
italicFlagThe flag of italic attribution.
editor.BindPdf("example.pdf");
editor.CreateBookmarks(System.Drawing.Color.Red, true, true);
editor.Save("example_out.pdf");

◆ DeleteBookmarks() [1/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::DeleteBookmarks ( )

Deletes all bookmarks of the PDF document.

editor.BindPdf("example.pdf");
editor.DeleteBookmarks();
editor.Save("example_out.pdf");

◆ DeleteBookmarks() [2/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::DeleteBookmarks ( System::String  title)

Deletes the bookmark of the PDF document.

Parameters
titleThe title of bookmark deleted.
editor.BindPdf("example.pdf");
editor.DeleteBookmarks("existing bookmark title");
editor.Save("example_out.pdf");

◆ ExportBookmarksToHtml()

static void Aspose::Pdf::Facades::PdfBookmarkEditor::ExportBookmarksToHtml ( System::String  inPdfFile,
System::String  outHtmlFile 
)
static

Exports bookmarks to HTML file.

Parameters
inPdfFileInput PDF file which bookmarks will be exported.
outHtmlFileOutput HTML file
PdfBookmarkEditor.ExtractBookmarksToHTML("example.pdf", "bookmarks.html");

◆ ExportBookmarksToXML() [1/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::ExportBookmarksToXML ( System::String  xmlFile)

Exports bookmarks to XML file.

Parameters
xmlFileThe output XML file.
editor.BindPdf("example.pdf");
editor.ExportBookmarksToXML("bookmarks.xml");

◆ ExportBookmarksToXML() [2/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::ExportBookmarksToXML ( System::SharedPtr< System::IO::Stream stream)

Exports bookmarks to XML stream.

Parameters
streamOutput stream where data will be stored.

◆ ExtractBookmarks() [1/4]

System::SharedPtr<Bookmarks> Aspose::Pdf::Facades::PdfBookmarkEditor::ExtractBookmarks ( )

Extracts bookmarks of all levels from the document.

Returns
The bookmarks collection of all bookmarks that exist in the document.
editor.BindPdf("example.pdf");
Bookmarks bms = editor.ExtractBookmarks();
foreach(Bookmark bm in bms)
Console.WriteLine(bm.Title);

◆ ExtractBookmarks() [2/4]

System::SharedPtr<Bookmarks> Aspose::Pdf::Facades::PdfBookmarkEditor::ExtractBookmarks ( bool  upperLevel)

Extracts bookmarks of all levels from the document.

Parameters
upperLevelIf true, extracts only upper level bookmarks. Else, extracts all bookmarks recursively.
Returns
List of extracted bookmarks.

◆ ExtractBookmarks() [3/4]

System::SharedPtr<Bookmarks> Aspose::Pdf::Facades::PdfBookmarkEditor::ExtractBookmarks ( System::String  title)

Extracts the bookmarks with the specified title.

Parameters
titleExtracted item title.
Returns
Bookmark collection has items with the same title.
editor.BindPdf("example.pdf");
Bookmarks bms = editor.ExtractBookmarks("Title");
foreach(Bookmark bm in bms)
Console.WriteLine(bm.Title);

◆ ExtractBookmarks() [4/4]

System::SharedPtr<Bookmarks> Aspose::Pdf::Facades::PdfBookmarkEditor::ExtractBookmarks ( System::SharedPtr< Bookmark bookmark)

Extracts the children of a bookmark with a title like in specified bookamrk.

Parameters
bookmarkThe specified bookamrk.
Returns
Bookmark collection with child bookmarks.
editor.BindPdf("example.pdf");
Bookmark bookmark = new Bookmark();
bookmark.Title = "Title";
Bookmarks bms = editor.ExtractBookmarks(bookmark);
foreach(Bookmark bm in bms)
Console.WriteLine(bm.Title);

◆ ExtractBookmarksToHTML()

void Aspose::Pdf::Facades::PdfBookmarkEditor::ExtractBookmarksToHTML ( System::String  pdfFile,
System::String  cssFile 
)

Exports bookmarks to HTML file.

Parameters
pdfFileThe PDF file which bookmarks will be exported.
cssFileThe CSS file to display HTML file, can be null.
editor.ExtractBookmarksToHTML("example.pdf", null);

◆ ImportBookmarksWithXML() [1/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::ImportBookmarksWithXML ( System::String  xmlFile)

Imports bookmarks to the document from XML file.

Parameters
xmlFileThe XML file containing bookmarks list.
editor.BindPdf("example.pdf");
editor.ImportBookmarksWithXML("bookmarks.xml");
editor.Save("example_out.pdf");

◆ ImportBookmarksWithXML() [2/2]

void Aspose::Pdf::Facades::PdfBookmarkEditor::ImportBookmarksWithXML ( System::SharedPtr< System::IO::Stream stream)

Imports bookmarks to the document from XML file.

Parameters
streamStream with bookmarks data.

◆ ModifyBookmarks()

void Aspose::Pdf::Facades::PdfBookmarkEditor::ModifyBookmarks ( System::String  sTitle,
System::String  dTitle 
)

Modifys bookmark title according to the specified bookmark title.

Parameters
sTitleSource bookmark title.
dTitleModified bookmark title.
editor.BindPdf("example.pdf");
editor.ModifyBookmarks("existing bookmark title", "new bookmark title");
editor.Save("example_out.pdf");