> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/get-started/samples/pagelabelstest.md).

# PDF Page Labels - PageLabels

Sample code for using Apryse Server SDK to work with PDF page labels. PDF page labels can be used to describe a page, which is used to allow for non-sequential page numbering or the addition of arbitr

Sample code for using Apryse SDK to work with PDF page labels. PDF page labels can be used to describe a page, which is used to allow for non-sequential page numbering or the addition of arbitrary labels for a page (such as the inclusion of Roman numerals at the beginning of a book). Sample code provided in Python, C++, C#, Java, Node.js (JavaScript), PHP, Ruby and VB.

Learn more about our [Server SDK](/core/get-started/get-started.md) and [PDF Editing & Manipulation Library](/core/page-manipulation/manipulation.md).

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
//
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
//

using System;
using pdftron;
using pdftron.SDF;
using pdftron.PDF;

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
//-----------------------------------------------------------------------------------
namespace PageLabelsTestCS
{
	class Class1
	{
		private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance();
		static Class1() {}
		
		// Relative path to the folder containing test files.
		const string input_path =  "../../../../TestFiles/";
		const string output_path = "../../../../TestFiles/Output/";

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			PDFNet.Initialize(PDFTronLicense.Key);
			try
			{
				//-----------------------------------------------------------
				// Example 1: Add page labels to an existing or newly created PDF
				// document.
				//-----------------------------------------------------------
				{
					using (PDFDoc doc = new PDFDoc(input_path + "newsletter.pdf"))
					{
						doc.InitSecurityHandler();

						// Create a page labeling scheme that starts with the first page in 
						// the document (page 1) and is using uppercase roman numbering 
						// style. 
						doc.SetPageLabel(1, PageLabel.Create(doc, PageLabel.Style.e_roman_uppercase, "My Prefix ", 1));

						// Create a page labeling scheme that starts with the fourth page in 
						// the document and is using decimal arabic numbering style. 
						// Also the numeric portion of the first label should start with number 
						// 4 (otherwise the first label would be "My Prefix 1"). 
						PageLabel L2 = PageLabel.Create(doc, PageLabel.Style.e_decimal, "My Prefix ", 4);
						doc.SetPageLabel(4, L2);

						// Create a page labeling scheme that starts with the seventh page in 
						// the document and is using alphabetic numbering style. The numeric 
						// portion of the first label should start with number 1. 
						PageLabel L3 = PageLabel.Create(doc, PageLabel.Style.e_alphabetic_uppercase, "My Prefix ", 1);
						doc.SetPageLabel(7, L3);

						doc.Save(output_path + "newsletter_with_pagelabels.pdf", SDFDoc.SaveOptions.e_linearized);
						Console.WriteLine("Done. Result saved in newsletter_with_pagelabels.pdf..."); 
					}
				}

				//-----------------------------------------------------------
				// Example 2: Read page labels from an existing PDF document.
				//-----------------------------------------------------------
				{
					using (PDFDoc doc = new PDFDoc(output_path + "newsletter_with_pagelabels.pdf"))
					{
						doc.InitSecurityHandler();

						PageLabel label;
						int page_num = doc.GetPageCount();
						for (int i=1; i<=page_num; ++i) 
						{
							Console.Write("Page number: {0}", i);
							label = doc.GetPageLabel(i);
							if (label.IsValid()) {
								Console.WriteLine(" Label: {0}", label.GetLabelTitle(i)); 
							}
							else {
								Console.WriteLine(" No Label."); 
							}
						}
					}
				}

				//-----------------------------------------------------------
				// Example 3: Modify page labels from an existing PDF document.
				//-----------------------------------------------------------
				{
					using (PDFDoc doc = new PDFDoc(output_path + "newsletter_with_pagelabels.pdf"))
					{
						doc.InitSecurityHandler();

						// Remove the alphabetic labels from example 1.
						doc.RemovePageLabel(7); 

						// Replace the Prefix in the decimal lables (from example 1).
						PageLabel label = doc.GetPageLabel(4);
						if (label.IsValid()) {
							label.SetPrefix("A");
							label.SetStart(1);
						}

						// Add a new label
						PageLabel new_label = PageLabel.Create(doc, PageLabel.Style.e_decimal, "B", 1);
						doc.SetPageLabel(10, new_label);  // starting from page 10.

						doc.Save(output_path + "newsletter_with_pagelabels_modified.pdf", SDFDoc.SaveOptions.e_linearized);
						Console.WriteLine("Done. Result saved in newsletter_with_pagelabels_modified.pdf..."); 

						int page_num = doc.GetPageCount();
						for (int i=1; i<=page_num; ++i) 
						{
							Console.Write("Page number: {0}", i);
							label = doc.GetPageLabel(i);
							if (label.IsValid()) {
								Console.WriteLine(" Label: {0}", label.GetLabelTitle(i));
							}
							else {
								Console.WriteLine(" No Label."); 
							}
						}
					}
				}

				//-----------------------------------------------------------
				// Example 4: Delete all page labels in an existing PDF document.
				//-----------------------------------------------------------
				{
					using (PDFDoc doc = new PDFDoc(output_path + "newsletter_with_pagelabels.pdf"))
					{
						doc.GetRoot().Erase("PageLabels");
						// ...
					}
				}
			}
			catch (pdftron.Common.PDFNetException e)
			{
				Console.WriteLine(e.Message);
			}
			PDFNet.Terminate();
		}
	}
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.
//---------------------------------------------------------------------------------------

#include <PDF/PDFNet.h>
#include <PDF/PDFDoc.h>
#include <PDF/PageLabel.h>

#include <iostream>
#include "../../LicenseKey/CPP/LicenseKey.h"

using namespace std;
using namespace pdftron;
using namespace PDF;

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
//-----------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
	int ret = 0;
	PDFNet::Initialize(LicenseKey);

	// Relative path to the folder containing test files.
	string input_path =  "../../TestFiles/";
	string output_path = "../../TestFiles/Output/";

	try  
	{	
		//-----------------------------------------------------------
		// Example 1: Add page labels to an existing or newly created PDF
		// document.
		//-----------------------------------------------------------
		{
			PDFDoc doc((input_path + "newsletter.pdf").c_str());
			doc.InitSecurityHandler();

			// Create a page labeling scheme that starts with the first page in 
			// the document (page 1) and is using uppercase roman numbering 
			// style. 
			PageLabel L1 = PageLabel::Create(doc, PageLabel::e_roman_uppercase, "My Prefix ", 1);
			doc.SetPageLabel(1, L1);

			// Create a page labeling scheme that starts with the fourth page in 
			// the document and is using decimal Arabic numbering style. 
			// Also the numeric portion of the first label should start with number 
			// 4 (otherwise the first label would be "My Prefix 1"). 
			PageLabel L2 = PageLabel::Create(doc, PageLabel::e_decimal, "My Prefix ", 4);
			doc.SetPageLabel(4, L2);

			// Create a page labeling scheme that starts with the seventh page in 
			// the document and is using alphabetic numbering style. The numeric 
			// portion of the first label should start with number 1. 
			PageLabel L3 = PageLabel::Create(doc, PageLabel::e_alphabetic_uppercase, "My Prefix ", 1);
			doc.SetPageLabel(7, L3);

			doc.Save((output_path + "newsletter_with_pagelabels.pdf").c_str(), SDF::SDFDoc::e_linearized, 0);
			cout << "Done. Result saved in newsletter_with_pagelabels.pdf..." << endl;
		}

		//-----------------------------------------------------------
		// Example 2: Read page labels from an existing PDF document.
		//-----------------------------------------------------------
		{
			PDFDoc doc((output_path + "newsletter_with_pagelabels.pdf").c_str());
			doc.InitSecurityHandler();

			PageLabel label;
			int page_num = doc.GetPageCount();
			for (int i=1; i<=page_num; ++i) 
			{
				cout << "Page number: " << i; 
				label = doc.GetPageLabel(i);
				if (label.IsValid()) {
					cout << " Label: " << label.GetLabelTitle(i) << endl; 
				}
				else {
					cout << " No Label." << endl; 
				}
			}
		}

		//-----------------------------------------------------------
		// Example 3: Modify page labels from an existing PDF document.
		//-----------------------------------------------------------
		{
			PDFDoc doc((output_path + "newsletter_with_pagelabels.pdf").c_str());
			doc.InitSecurityHandler();

			// Remove the alphabetic labels from example 1.
			doc.RemovePageLabel(7); 

			// Replace the Prefix in the decimal labels (from example 1).
			PageLabel label = doc.GetPageLabel(4);
			if (label.IsValid()) {
				label.SetPrefix("A");
				label.SetStart(1);
			}

			// Add a new label
			PageLabel new_label = PageLabel::Create(doc, PageLabel::e_decimal, "B", 1);
			doc.SetPageLabel(10, new_label);  // starting from page 10.

			doc.Save((output_path + "newsletter_with_pagelabels_modified.pdf").c_str(), SDF::SDFDoc::e_linearized, 0);
			cout << "Done. Result saved in newsletter_with_pagelabels_modified.pdf..." << endl;

			int page_num = doc.GetPageCount();
			for (int i=1; i<=page_num; ++i) 
			{
				cout << "Page number: " << i; 
				label = doc.GetPageLabel(i);
				if (label.IsValid()) {
					cout << " Label: " << label.GetLabelTitle(i) << endl; 
				}
				else {
					cout << " No Label." << endl; 
				}
			}
		}

		//-----------------------------------------------------------
		// Example 4: Delete all page labels in an existing PDF document.
		//-----------------------------------------------------------
		{
			PDFDoc doc((output_path + "newsletter_with_pagelabels.pdf").c_str());
			doc.GetRoot().Erase("PageLabels");
			// ...
		}
	}
	catch(Common::Exception& e)
	{
		cout << e << endl;
		ret = 1;
	}
	catch(...)
	{
		cout << "Unknown Exception" << endl;
		ret = 1;
	}

	PDFNet::Terminate();
	return ret;
}
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
// Consult LICENSE.txt regarding license information.
//---------------------------------------------------------------------------------------

package main
import (
	"fmt"
    "strconv"
	. "pdftron"
)

import  "pdftron/Samples/LicenseKey/GO"

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
//-----------------------------------------------------------------------------------

// Relative path to the folder containing the test files.
var inputPath = "../../TestFiles/"
var outputPath = "../../TestFiles/Output/"

func main(){
    // Initialize PDFNet
    PDFNetInitialize(PDFTronLicense.Key)
    
    //-----------------------------------------------------------
    // Example 1: Add page labels to an existing or newly created PDF
    // document.
    //-----------------------------------------------------------
    
    doc := NewPDFDoc(inputPath + "newsletter.pdf")
    doc.InitSecurityHandler()
    
    // Create a page labeling scheme that starts with the first page in 
    // the document (page 1) and is using uppercase roman numbering 
    // style. 
    L1 := PageLabelCreate(doc.GetSDFDoc(), PageLabelE_roman_uppercase, "My Prefix ", 1)
    doc.SetPageLabel(1, L1)
    
    // Create a page labeling scheme that starts with the fourth page in 
    // the document and is using decimal arabic numbering style. 
    // Also the numeric portion of the first label should start with number 
    // 4 (otherwise the first label would be "My Prefix 1").
    L2 := PageLabelCreate(doc.GetSDFDoc(), PageLabelE_decimal, "My Prefix ", 4)
    doc.SetPageLabel(4, L2)
    
    // Create a page labeling scheme that starts with the seventh page in 
    // the document and is using alphabetic numbering style. The numeric 
    // portion of the first label should start with number 1. 
    L3 := PageLabelCreate(doc.GetSDFDoc(), PageLabelE_alphabetic_uppercase, "My Prefix ", 1)
    doc.SetPageLabel(7, L3)
    
    doc.Save(outputPath + "newsletter_with_pagelabels.pdf", uint(SDFDocE_linearized))
    doc.Close()
    fmt.Println("Done. Result saved in newsletter_with_pagelabels.pdf...")
    
    //-----------------------------------------------------------
    // Example 2: Read page labels from an existing PDF document.
    //-----------------------------------------------------------
    
    doc = NewPDFDoc(outputPath + "newsletter_with_pagelabels.pdf")
    doc.InitSecurityHandler()
    
    label := NewPageLabel()
    pageNum := doc.GetPageCount()
    
    i := 1
    for i <= pageNum{
        fmt.Println("Page number: " + strconv.Itoa(i))
        label = doc.GetPageLabel(i)
        
        if label.IsValid(){
            fmt.Println("Label: " + label.GetLabelTitle(i))
        }else{
            fmt.Println("No Label.")
        }
        i = i + 1
    }

    doc.Close()
            
    //-----------------------------------------------------------
    // Example 3: Modify page labels from an existing PDF document.
    //-----------------------------------------------------------
    
    doc = NewPDFDoc(outputPath + "newsletter_with_pagelabels.pdf")
    doc.InitSecurityHandler()
    
    // Remove the alphabetic labels from example i.
    doc.RemovePageLabel(7)
    
    // Replace the Prefix in the decimal labels (from example 1).
    label = doc.GetPageLabel(4)
    if label.IsValid(){
        label.SetPrefix("A")
        label.SetStart(1)
    }   
    // Add a new label
    newLabel := PageLabelCreate(doc.GetSDFDoc(), PageLabelE_decimal, "B", 1)
    doc.SetPageLabel(10, newLabel) // starting from page 10
    
    doc.Save(outputPath + "newsletter_with_pagelabels_modified.pdf", uint(SDFDocE_linearized))
    fmt.Println("Done. Result saved in newsletter_with_pagelabels_modified.pdf...")
    
    pageNum = doc.GetPageCount()
    i = 1
    for i <= pageNum{
        fmt.Println("Page number: " + strconv.Itoa(i))
        label = doc.GetPageLabel(i)
        if label.IsValid(){
            fmt.Println("Label: " + label.GetLabelTitle(i))
        }else{
            fmt.Println("No Label.")
        }
        i = i + 1
    }

    doc.Close()
        
    //-----------------------------------------------------------
    // Example 4: Delete all page labels in an existing PDF document.
    //----------------------------------------------------------- 
    
    doc = NewPDFDoc(outputPath + "newsletter_with_pagelabels.pdf")
    doc.GetRoot().Erase("PageLabels")
    doc.Save(outputPath + "newsletter_with_pagelabels_removed.pdf", uint(SDFDocE_linearized))
    
    doc.Close()    
    PDFNetTerminate()
}
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.
//---------------------------------------------------------------------------------------

import com.pdftron.pdf.*;
import com.pdftron.sdf.SDFDoc;

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
//-----------------------------------------------------------------------------------
public class PageLabelsTest {
    public static void main(String[] args) {
        PDFNet.initialize(PDFTronLicense.Key());

        // Relative path to the folder containing test files.
        String input_path = "../../TestFiles/";
        String output_path = "../../TestFiles/Output/";

        try {
            //-----------------------------------------------------------
            // Example 1: Add page labels to an existing or newly created PDF
            // document.
            //-----------------------------------------------------------
            try (PDFDoc doc = new PDFDoc((input_path + "newsletter.pdf"))) {
                doc.initSecurityHandler();

                // Create a page labeling scheme that starts with the first page in
                // the document (page 1) and is using uppercase roman numbering
                // style.
                doc.setPageLabel(1, PageLabel.create(doc, PageLabel.e_roman_uppercase, "My Prefix ", 1));

                // Create a page labeling scheme that starts with the fourth page in
                // the document and is using decimal arabic numbering style.
                // Also the numeric portion of the first label should start with number
                // 4 (otherwise the first label would be "My Prefix 1").
                PageLabel L2 = PageLabel.create(doc, PageLabel.e_decimal, "My Prefix ", 4);
                doc.setPageLabel(4, L2);

                // Create a page labeling scheme that starts with the seventh page in
                // the document and is using alphabetic numbering style. The numeric
                // portion of the first label should start with number 1.
                PageLabel L3 = PageLabel.create(doc, PageLabel.e_alphabetic_uppercase, "My Prefix ", 1);
                doc.setPageLabel(7, L3);

                doc.save(output_path + "newsletter_with_pagelabels.pdf", SDFDoc.SaveMode.LINEARIZED, null);
                System.out.println("Done. Result saved in newsletter_with_pagelabels.pdf...");
            }
            
            //-----------------------------------------------------------
            // Example 2: Read page labels from an existing PDF document.
            //-----------------------------------------------------------
            try (PDFDoc doc = new PDFDoc((output_path + "newsletter_with_pagelabels.pdf"))) {
                doc.initSecurityHandler();

                PageLabel label;
                int page_num = doc.getPageCount();
                for (int i = 1; i <= page_num; ++i) {
                    System.out.println("Page number: " + i);
                    label = doc.getPageLabel(i);
                    if (label.isValid()) {
                        System.out.println(" Label: " + label.getLabelTitle(i));
                    } else {
                        System.out.println(" No Label.");
                    }
                }
            }
            
            //-----------------------------------------------------------
            // Example 3: Modify page labels from an existing PDF document.
            //-----------------------------------------------------------
            try (PDFDoc doc = new PDFDoc((output_path + "newsletter_with_pagelabels.pdf"))) {
                doc.initSecurityHandler();

                // Remove the alphabetic labels from example 1.
                doc.removePageLabel(7);

                // Replace the Prefix in the decimal lables (from example 1).
                PageLabel label = doc.getPageLabel(4);
                if (label.isValid()) {
                    label.setPrefix("A");
                    label.setStart(1);
                }

                // Add a new label
                PageLabel new_label = PageLabel.create(doc, PageLabel.e_decimal, "B", 1);
                doc.setPageLabel(10, new_label);  // starting from page 10.

                doc.save(output_path + "newsletter_with_pagelabels_modified.pdf", SDFDoc.SaveMode.LINEARIZED, null);
                System.out.println("Done. Result saved in newsletter_with_pagelabels_modified.pdf...");

                int page_num = doc.getPageCount();
                for (int i = 1; i <= page_num; ++i) {
                    System.out.print("Page number: " + i);
                    label = doc.getPageLabel(i);
                    if (label.isValid()) {
                        System.out.println(" Label: " + label.getLabelTitle(i));
                    } else {
                        System.out.println(" No Label.");
                    }
                }
            }

            //-----------------------------------------------------------
            // Example 4: Delete all page labels in an existing PDF document.
            //-----------------------------------------------------------
            try (PDFDoc doc = new PDFDoc((output_path + "newsletter_with_pagelabels.pdf"))) {
                doc.getRoot().erase("PageLabels");
                // ...
            }
            
        } catch (Exception e) {
                e.printStackTrace();
        }
        
        PDFNet.terminate();
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.
//---------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, 'A-' to generate 'A-1', 'A-2', 'A-3', and so forth.)
//-----------------------------------------------------------------------------------

const { PDFNet } = require('@pdftron/pdfnet-node');
const PDFTronLicense = require('../LicenseKey/LicenseKey');

((exports) => {
  'use strict';

  exports.runPageLabelsTest = () => {
    const main = async () => {
      const inputPath = '../TestFiles/';
      const outputPath = inputPath + 'Output/';
      const outputFile = outputPath + 'newsletter_with_pagelabels.pdf';

      try {
        //-----------------------------------------------------------
        // Example 1: Add page labels to an existing or newly created PDF
        // document.
        //-----------------------------------------------------------
        {
          const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + 'newsletter.pdf');
          doc.initSecurityHandler();

          // Create a page labeling scheme that starts with the first page in 
          // the document (page 1) and is using uppercase roman numbering 
          // style. 
          const L1 = await PDFNet.PageLabel.create(doc, PDFNet.PageLabel.Style.e_roman_uppercase, 'My Prefix ', 1);
          doc.setPageLabel(1, L1);

          // Create a page labeling scheme that starts with the fourth page in 
          // the document and is using decimal Arabic numbering style. 
          // Also the numeric portion of the first label should start with number 
          // 4 (otherwise the first label would be 'My Prefix 1'). 
          const L2 = await PDFNet.PageLabel.create(doc, PDFNet.PageLabel.Style.e_decimal, 'My Prefix ', 4);
          doc.setPageLabel(4, L2);

          // Create a page labeling scheme that starts with the seventh page in 
          // the document and is using alphabetic numbering style. The numeric 
          // portion of the first label should start with number 1. 
          const L3 = await PDFNet.PageLabel.create(doc, PDFNet.PageLabel.Style.e_alphabetic_uppercase, 'My Prefix ', 1);
          doc.setPageLabel(7, L3);

          doc.save(outputFile, PDFNet.SDFDoc.SaveOptions.e_linearized);
          console.log('Done. Result saved in newsletter_with_pagelabels.pdf...');
        }

        //-----------------------------------------------------------
        // Example 2: Read page labels from an existing PDF document.
        //-----------------------------------------------------------
        {
          const doc = await PDFNet.PDFDoc.createFromFilePath(outputFile);
          doc.initSecurityHandler();

          const page_num = await doc.getPageCount();
          for (let i = 1; i <= page_num; ++i) {
            console.log('Page number: ' + i);
            const label = await doc.getPageLabel(i);
            if (await label.isValid()) {
              console.log(' Label: ' + await label.getLabelTitle(i));
            }
            else {
              console.log(' No Label.');
            }
          }
        }

        //-----------------------------------------------------------
        // Example 3: Modify page labels from an existing PDF document.
        //-----------------------------------------------------------
        {
          const doc = await PDFNet.PDFDoc.createFromFilePath(outputFile);
          doc.initSecurityHandler();

          // Remove the alphabetic labels from example 1.
          doc.removePageLabel(7);

          // Replace the Prefix in the decimal labels (from example 1).
          const label = await doc.getPageLabel(4);
          if (await label.isValid()) {
            await label.setPrefix('A');
            label.setStart(1);
          }

          // Add a new label
          const new_label = await PDFNet.PageLabel.create(doc, PDFNet.PageLabel.Style.e_decimal, 'B', 1);
          doc.setPageLabel(10, new_label);  // starting from page 10.

          doc.save(outputPath + 'newsletter_with_pagelabels_modified.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
          console.log('Done. Result saved in newsletter_with_pagelabels_modified.pdf...');

          const page_num = await doc.getPageCount();
          for (let i = 1; i <= page_num; ++i) {
            console.log('Page number: ' + i);
            const label = await doc.getPageLabel(i);
            if (await label.isValid()) {
              console.log(' Label: ' + await label.getLabelTitle(i));
            }
            else {
              console.log(' No Label.');
            }
          }
        }

        //-----------------------------------------------------------
        // Example 4: Delete all page labels in an existing PDF document.
        //-----------------------------------------------------------
        {
          const doc = await PDFNet.PDFDoc.createFromFilePath(outputFile);
          (await doc.getRoot()).eraseFromKey('PageLabels');
        }

      } catch (err) {
        console.log(err);
      }
    }
    PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error) {
      console.log('Error: ' + JSON.stringify(error));
    }).then(function(){ return PDFNet.shutdown(); });
  };
  exports.runPageLabelsTest();
})(exports);
// eslint-disable-next-line spaced-comment
//# sourceURL=PageLabelsTest.js
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
#---------------------------------------------------------------------------------------
# Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
# Consult LICENSE.txt regarding license information.
#---------------------------------------------------------------------------------------

import site
site.addsitedir("../../../PDFNetC/Lib")
import sys
from PDFNetPython import *

sys.path.append("../../LicenseKey/PYTHON")
from LicenseKey import *

#-----------------------------------------------------------------------------------
# The sample illustrates how to work with PDF page labels.
#
# PDF page labels can be used to describe a page. This is used to 
# allow for non-sequential page numbering or the addition of arbitrary 
# labels for a page (such as the inclusion of Roman numerals at the 
# beginning of a book). PDFNet PageLabel object can be used to specify 
# the numbering style to use (for example, upper- or lower-case Roman, 
# decimal, and so forth), the starting number for the first page,
# and an arbitrary prefix to be pre-appended to each number (for 
# example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
#-----------------------------------------------------------------------------------

# Relative path to the folder containing the test files.
input_path = "../../TestFiles/"
output_path = "../../TestFiles/Output/"

def main():
    # Initialize PDFNet
    PDFNet.Initialize(LicenseKey)
    
    #-----------------------------------------------------------
    # Example 1: Add page labels to an existing or newly created PDF
    # document.
    #-----------------------------------------------------------
    
    doc = PDFDoc(input_path + "newsletter.pdf")
    doc.InitSecurityHandler()
    
    # Create a page labeling scheme that starts with the first page in 
    # the document (page 1) and is using uppercase roman numbering 
    # style. 
    L1 = PageLabel.Create(doc.GetSDFDoc(), PageLabel.e_roman_uppercase, "My Prefix ", 1)
    doc.SetPageLabel(1, L1)
    
    # Create a page labeling scheme that starts with the fourth page in 
    # the document and is using decimal arabic numbering style. 
    # Also the numeric portion of the first label should start with number 
    # 4 (otherwise the first label would be "My Prefix 1").
    L2 = PageLabel.Create(doc.GetSDFDoc(), PageLabel.e_decimal, "My Prefix ", 4)
    doc.SetPageLabel(4, L2)
    
    # Create a page labeling scheme that starts with the seventh page in 
    # the document and is using alphabetic numbering style. The numeric 
    # portion of the first label should start with number 1. 
    L3 = PageLabel.Create(doc.GetSDFDoc(), PageLabel.e_alphabetic_uppercase, "My Prefix ", 1)
    doc.SetPageLabel(7, L3)
    
    doc.Save(output_path + "newsletter_with_pagelabels.pdf", SDFDoc.e_linearized)
    doc.Close()
    print("Done. Result saved in newsletter_with_pagelabels.pdf...")
    
    #-----------------------------------------------------------
    # Example 2: Read page labels from an existing PDF document.
    #-----------------------------------------------------------
    
    doc = PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
    doc.InitSecurityHandler()
    
    label = PageLabel()
    page_num = doc.GetPageCount()
    
    i = 1
    while i <= page_num:
        print("Page number: " + str(i))
        label = doc.GetPageLabel(i)
        
        if label.IsValid():
            print("Label: " + label.GetLabelTitle(i))
        else:
            print("No Label.")
        i = i + 1
    
    doc.Close()
            
    #-----------------------------------------------------------
    # Example 3: Modify page labels from an existing PDF document.
    #-----------------------------------------------------------
    
    doc = PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
    doc.InitSecurityHandler()
    
    # Remove the alphabetic labels from example i.
    doc.RemovePageLabel(7)
    
    # Replace the Prefix in the decimal labels (from example 1).
    label = doc.GetPageLabel(4)
    if label.IsValid():
        label.SetPrefix("A")
        label.SetStart(1)
        
    # Add a new label
    new_label = PageLabel.Create(doc.GetSDFDoc(), PageLabel.e_decimal, "B", 1)
    doc.SetPageLabel(10, new_label) # starting from page 10
    
    doc.Save(output_path + "newsletter_with_pagelabels_modified.pdf", SDFDoc.e_linearized)
    print("Done. Result saved in newsletter_with_pagelabels_modified.pdf...")
    
    page_num = doc.GetPageCount()
    i = 1
    while i <= page_num:
        print("Page number: " + str(i))
        label = doc.GetPageLabel(i)
        if label.IsValid():
            print("Label: " + label.GetLabelTitle(i))
        else:
            print("No Label.")
        i = i + 1
    
    doc.Close()
        
    #-----------------------------------------------------------
    # Example 4: Delete all page labels in an existing PDF document.
    #----------------------------------------------------------- 
    
    doc = PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
    doc.GetRoot().Erase("PageLabels")
    doc.Save(output_path + "newsletter_with_pagelabels_removed.pdf", SDFDoc.e_linearized)
    
    doc.Close()    
    PDFNet.Terminate()

if __name__ == '__main__':
    main()
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
<?php
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
// Consult LICENSE.txt regarding license information.
//---------------------------------------------------------------------------------------
if(file_exists("../../../PDFNetC/Lib/PDFNetPHP.php"))
include("../../../PDFNetC/Lib/PDFNetPHP.php");
include("../../LicenseKey/PHP/LicenseKey.php");

// Relative path to the folder containing the test files.
$input_path = getcwd()."/../../TestFiles/";
$output_path = $input_path."Output/";

//-----------------------------------------------------------------------------------
// The sample illustrates how to work with PDF page labels.
//
// PDF page labels can be used to describe a page. This is used to 
// allow for non-sequential page numbering or the addition of arbitrary 
// labels for a page (such as the inclusion of Roman numerals at the 
// beginning of a book). PDFNet PageLabel object can be used to specify 
// the numbering style to use (for example, upper- or lower-case Roman, 
// decimal, and so forth), the starting number for the first page,
// and an arbitrary prefix to be pre-appended to each number (for 
// example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
//-----------------------------------------------------------------------------------

	PDFNet::Initialize($LicenseKey);
	PDFNet::GetSystemFontList();    // Wait for fonts to be loaded if they haven't already. This is done because PHP can run into errors when shutting down if font loading is still in progress.

	//-----------------------------------------------------------
	// Example 1: Add page labels to an existing or newly created PDF
	// document.
	//-----------------------------------------------------------
	
	$doc = new PDFDoc($input_path."newsletter.pdf");
	$doc->InitSecurityHandler();

	// Create a page labeling scheme that starts with the first page in 
	// the document (page 1) and is using uppercase roman numbering 
	// style. 
	$L1 = PageLabel::Create($doc->GetSDFDoc(), PageLabel::e_roman_uppercase, "My Prefix ", 1);
	$doc->SetPageLabel(1, $L1);

	// Create a page labeling scheme that starts with the fourth page in 
	// the document and is using decimal Arabic numbering style. 
	// Also the numeric portion of the first label should start with number 
	// 4 (otherwise the first label would be "My Prefix 1"). 
	$L2 = PageLabel::Create($doc->GetSDFDoc(), PageLabel::e_decimal, "My Prefix ", 4);
	$doc->SetPageLabel(4, $L2);

	// Create a page labeling scheme that starts with the seventh page in 
	// the document and is using alphabetic numbering style. The numeric 
	// portion of the first label should start with number 1. 
	$L3 = PageLabel::Create($doc->GetSDFDoc(), PageLabel::e_alphabetic_uppercase, "My Prefix ", 1);
	$doc->SetPageLabel(7, $L3);

	$doc->Save($output_path."newsletter_with_pagelabels.pdf", SDFDoc::e_linearized);
	echo nl2br("Done. Result saved in newsletter_with_pagelabels.pdf...\n");
	
	//-----------------------------------------------------------
	// Example 2: Read page labels from an existing PDF document.
	//-----------------------------------------------------------
	
	$doc = new PDFDoc($output_path."newsletter_with_pagelabels.pdf");
	$doc->InitSecurityHandler();

	$label = new PageLabel();
	$page_num = $doc->GetPageCount();
	for ($i=1; $i<=$page_num; ++$i) 
	{
		echo "Page number: ".$i; 
		$label = $doc->GetPageLabel($i);
		if ($label->IsValid()) {
			echo nl2br(" Label: ".$label->GetLabelTitle($i)."\n"); 
		}
		else {
			echo nl2br(" No Label.\n"); 
		}
	}
	
	//-----------------------------------------------------------
	// Example 3: Modify page labels from an existing PDF document.
	//-----------------------------------------------------------
	
	$doc = new PDFDoc($output_path."newsletter_with_pagelabels.pdf");
	$doc->InitSecurityHandler();

	// Remove the alphabetic labels from example 1.
	$doc->RemovePageLabel(7); 

	// Replace the Prefix in the decimal labels (from example 1).
	$label = $doc->GetPageLabel(4);
	if ($label->IsValid()) {
		$label->SetPrefix("A");
		$label->SetStart(1);
	}

	// Add a new label
	$new_label = PageLabel::Create($doc->GetSDFDoc(), PageLabel::e_decimal, "B", 1);
	$doc->SetPageLabel(10, $new_label);  // starting from page 10.

	$doc->Save($output_path."newsletter_with_pagelabels_modified.pdf", SDFDoc::e_linearized);
	echo nl2br("Done. Result saved in newsletter_with_pagelabels_modified.pdf...\n");

	$page_num = $doc->GetPageCount();
	for ($i=1; $i<=$page_num; ++$i) 
	{
		echo "Page number: ".$i; 
		$label = $doc->GetPageLabel($i);
		if ($label->IsValid()) {
			echo nl2br(" Label: ".$label->GetLabelTitle($i)."\n"); 
		}
		else {
			echo nl2br(" No Label.\n"); 
		}
	}
	
	$doc->Close();

	//-----------------------------------------------------------
	// Example 4: Delete all page labels in an existing PDF document.
	//-----------------------------------------------------------
	
	$doc = new PDFDoc ($output_path."newsletter_with_pagelabels.pdf");
	$doc->GetRoot()->Erase("PageLabels");
	$doc->Save($output_path."newsletter_with_pagelabels_removed.pdf", SDFDoc::e_linearized);
	PDFNet::Terminate();
	echo nl2br("Done. Result saved in newsletter_with_pagelabels_removed.pdf...\n");
	// ...
?>
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
#---------------------------------------------------------------------------------------
# Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
# Consult LICENSE.txt regarding license information.
#---------------------------------------------------------------------------------------

require '../../../PDFNetC/Lib/PDFNetRuby'
include PDFNetRuby
require '../../LicenseKey/RUBY/LicenseKey'

$stdout.sync = true

#-----------------------------------------------------------------------------------
# The sample illustrates how to work with PDF page labels.
#
# PDF page labels can be used to describe a page. This is used to 
# allow for non-sequential page numbering or the addition of arbitrary 
# labels for a page (such as the inclusion of Roman numerals at the 
# beginning of a book). PDFNet PageLabel object can be used to specify 
# the numbering style to use (for example, upper- or lower-case Roman, 
# decimal, and so forth), the starting number for the first page,
# and an arbitrary prefix to be pre-appended to each number (for 
# example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
#-----------------------------------------------------------------------------------

# Relative path to the folder containing the test files.
input_path = "../../TestFiles/"
output_path = "../../TestFiles/Output/"

	# Initialize PDFNet
	PDFNet.Initialize(PDFTronLicense.Key)
	
	#-----------------------------------------------------------
	# Example 1: Add page labels to an existing or newly created PDF
	# document.
	#-----------------------------------------------------------
	
	doc = PDFDoc.new(input_path + "newsletter.pdf")
	doc.InitSecurityHandler
	
	# Create a page labeling scheme that starts with the first page in 
	# the document (page 1) and is using uppercase roman numbering 
	# style. 
	L1 = PageLabel.Create(doc.GetSDFDoc, PageLabel::E_roman_uppercase, "My Prefix ", 1)
	doc.SetPageLabel(1, L1)
	
	# Create a page labeling scheme that starts with the fourth page in 
	# the document and is using decimal arabic numbering style. 
	# Also the numeric portion of the first label should start with number 
	# 4 (otherwise the first label would be "My Prefix 1").
	L2 = PageLabel.Create(doc.GetSDFDoc, PageLabel::E_decimal, "My Prefix ", 4)
	doc.SetPageLabel(4, L2)
	
	# Create a page labeling scheme that starts with the seventh page in 
	# the document and is using alphabetic numbering style. The numeric 
	# portion of the first label should start with number 1. 
	L3 = PageLabel.Create(doc.GetSDFDoc, PageLabel::E_alphabetic_uppercase, "My Prefix ", 1)
	doc.SetPageLabel(7, L3)
	
	doc.Save(output_path + "newsletter_with_pagelabels.pdf", SDFDoc::E_linearized)
	doc.Close
	puts "Done. Result saved in newsletter_with_pagelabels.pdf..."
	
	#-----------------------------------------------------------
	# Example 2: Read page labels from an existing PDF document.
	#-----------------------------------------------------------
	
	doc = PDFDoc.new(output_path + "newsletter_with_pagelabels.pdf")
	doc.InitSecurityHandler
	
	label = PageLabel.new
	page_num = doc.GetPageCount
	
	i = 1
	while i <= page_num do
		puts "Page number: " + i.to_s
		label = doc.GetPageLabel(i)
		
		if label.IsValid
			puts "Label: " + label.GetLabelTitle(i)
		else
			puts "No Label."
		end
		i = i + 1
	end
	
	doc.Close
			
	#-----------------------------------------------------------
	# Example 3: Modify page labels from an existing PDF document.
	#-----------------------------------------------------------
	
	doc = PDFDoc.new(output_path + "newsletter_with_pagelabels.pdf")
	doc.InitSecurityHandler
	
	# Remove the alphabetic labels from example i.
	doc.RemovePageLabel(7)
	
	# Replace the Prefix in the decimal labels (from example 1).
	label = doc.GetPageLabel(4)
	if label.IsValid
		label.SetPrefix("A")
		label.SetStart(1)
	end
		
	# Add a new label
	new_label = PageLabel.Create(doc.GetSDFDoc, PageLabel::E_decimal, "B", 1)
	doc.SetPageLabel(10, new_label)	# starting from page 10
	
	doc.Save(output_path + "newsletter_with_pagelabels_modified.pdf", SDFDoc::E_linearized)
	puts "Done. Result saved in newsletter_with_pagelabels_modified.pdf..."
	
	page_num = doc.GetPageCount
	i = 1
	while i <= page_num do
		puts "Page number: " + i.to_s
		label = doc.GetPageLabel(i)
		if label.IsValid
			puts "Label: " + label.GetLabelTitle(i)
		else
			puts "No Label."
		end
		i = i + 1
	end
	
	doc.Close
		
	#-----------------------------------------------------------
	# Example 4: Delete all page labels in an existing PDF document.
	#----------------------------------------------------------- 
	
	doc = PDFDoc.new(output_path + "newsletter_with_pagelabels.pdf")
	doc.GetRoot.Erase("PageLabels")
	doc.Save(output_path + "newsletter_with_pagelabels_removed.pdf", SDFDoc::E_linearized)
	
	doc.Close
	PDFNet.Terminate
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
'
' Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
'
Imports System

Imports pdftron
Imports pdftron.Common
Imports pdftron.SDF
Imports pdftron.PDF


'-----------------------------------------------------------------------------------
' The sample illustrates how to work with PDF page labels.
'
' PDF page labels can be used to describe a page. This is used to 
' allow for non-sequential page numbering or the addition of arbitrary 
' labels for a page (such as the inclusion of Roman numerals at the 
' beginning of a book). PDFNet PageLabel object can be used to specify 
' the numbering style to use (for example, upper- or lower-case Roman, 
' decimal, and so forth), the starting number for the first page,
' and an arbitrary prefix to be pre-appended to each number (for 
' example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)
'-----------------------------------------------------------------------------------
Module PageLabelsTestVB
	Dim pdfNetLoader As PDFNetLoader
	Sub New()
		pdfNetLoader = pdftron.PDFNetLoader.Instance()
	End Sub

	' Relative path to the folder containing test files.
	Dim input_path As String = "../../../../TestFiles/"
	Dim output_path As String = "../../../../TestFiles/Output/"

	Sub Main()

		PDFNet.Initialize(PDFTronLicense.Key)
		Try
			'-----------------------------------------------------------
			' Example 1: Add page labels to an existing or newly created PDF
			' document.
			'-----------------------------------------------------------
			Using doc As PDFDoc = New PDFDoc(input_path + "newsletter.pdf")
				doc.InitSecurityHandler()

				' Create a page labeling scheme that starts with the first page in 
				' the document (page 1) and is using uppercase roman numbering 
				' style. 
				doc.SetPageLabel(1, PageLabel.Create(doc.GetSDFDoc(), PageLabel.Style.e_roman_uppercase, "My Prefix ", 1))

				' Create a page labeling scheme that starts with the fourth page in 
				' the document and is using decimal arabic numbering style. 
				' Also the numeric portion of the first label should start with number 
				' 4 (otherwise the first label would be "My Prefix 1"). 
				Dim L2 As PageLabel = PageLabel.Create(doc.GetSDFDoc(), PageLabel.Style.e_decimal, "My Prefix ", 4)
				doc.SetPageLabel(4, L2)

				' Create a page labeling scheme that starts with the seventh page in 
				' the document and is using alphabetic numbering style. The numeric 
				' portion of the first label should start with number 1. 
				Dim L3 As PageLabel = PageLabel.Create(doc.GetSDFDoc(), PageLabel.Style.e_alphabetic_uppercase, "My Prefix ", 1)
				doc.SetPageLabel(7, L3)

				doc.Save(output_path + "newsletter_with_pagelabels.pdf", SDF.SDFDoc.SaveOptions.e_linearized)
				Console.WriteLine("Done. Result saved in newsletter_with_pagelabels.pdf...")
			End Using
		Catch ex As PDFNetException
			Console.WriteLine(ex.Message)
		Catch ex As Exception
			MsgBox(ex.Message)
		End Try

		'-----------------------------------------------------------
		' Example 2: Read page labels from an existing PDF document.
		'-----------------------------------------------------------
		Try
			Using doc As PDFDoc = New PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
				doc.InitSecurityHandler()

				Dim label As PageLabel
				Dim page_num As Integer = doc.GetPageCount()

				Dim i As Integer
				For i = 1 To page_num
					Console.Write("Page number: {0}", i)
					label = doc.GetPageLabel(i)
					If label.IsValid() Then
						Console.WriteLine(" Label: {0}", label.GetLabelTitle(i))
					Else
						Console.WriteLine(" No Label.")
					End If
				Next i
			End Using
		Catch ex As PDFNetException
			Console.WriteLine(ex.Message)
		Catch ex As Exception
			MsgBox(ex.Message)
		End Try

		'-----------------------------------------------------------
		' Example 3: Modify page labels from an existing PDF document.
		'-----------------------------------------------------------
		Try
			Using doc As PDFDoc = New PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
				doc.InitSecurityHandler()

				'Remove the alphabetic labels from example 1.
				doc.RemovePageLabel(7)

				' Replace the Prefix in the decimal lables (from example 1).
				Dim label As PageLabel = doc.GetPageLabel(4)
				If (label.IsValid()) Then
					label.SetPrefix("A")
					label.SetStart(1)
				End If

				' Add a new label
				Dim new_label As PageLabel = PageLabel.Create(doc.GetSDFDoc(), PageLabel.Style.e_decimal, "B", 1)
				doc.SetPageLabel(10, new_label)		   ' starting from page 10.

				doc.Save(output_path + "newsletter_with_pagelabels_modified.pdf", SDF.SDFDoc.SaveOptions.e_linearized)
				Console.WriteLine("Done. Result saved in newsletter_with_pagelabels_modified.pdf...")

				Dim page_num As Integer = doc.GetPageCount()
				Dim i As Integer
				For i = 1 To page_num
					Console.Write("Page number: {0}", i)
					label = doc.GetPageLabel(i)
					If (label.IsValid()) Then
						Console.WriteLine(" Label: {0}", label.GetLabelTitle(i))
					Else
						Console.WriteLine(" No Label.")
					End If
				Next i
			End Using
		Catch ex As PDFNetException
			Console.WriteLine(ex.Message)
		Catch ex As Exception
			MsgBox(ex.Message)
		End Try

		'-----------------------------------------------------------
		' Example 4: Delete all page labels in an existing PDF document.
		'-----------------------------------------------------------
		Try
			Using doc As PDFDoc = New PDFDoc(output_path + "newsletter_with_pagelabels.pdf")
				doc.GetRoot().Erase("PageLabels")
				' ...
			End Using
		Catch ex As PDFNetException
			Console.WriteLine(ex.Message)
		Catch ex As Exception
			MsgBox(ex.Message)
		End Try
		PDFNet.Terminate()
	End Sub
End Module
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/get-started/samples/pagelabelstest.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
