Skip to content

Generate PDF /PageLabel for page numbering defined as a function #8387

Open

Description

@cppHusky

Description

I found when the page.numbering accepts numbering pattern (string), the generated PDF contains an object with /PageLabel.

However, when the page.numbering accepts a function, it contains no object with /PageLabel, which means the PDF viewer will not display the page label.

I think the returned value of those functions should be included as /PageLabel.

Use Case

I just want to set the numbering of first page as cover. It doesn't contain the char a so I have to use the function (..__)=>"(cover)". However, the PDF viewer doesn't display cover for the first page as I expected.

Here is a minimum use case:

#set page(
	width:auto,
	height:auto,
	margin:5mm,
	//numbering:(..__)=>"cover",
	numbering:"1",
	//numbering:"coverpage",
)
#pagebreak()

When I set numbering:"1" the PDF includes:

5 0 obj
<<
  /Type /PageLabel
  /S /D
  /St 1
>>
endobj

6 0 obj
<<
  /Type /PageLabel
  /S /D
  /St 2
>>
endobj

And when I set numbering:"coverpage" the PDF includes:

5 0 obj
<<
  /Type /PageLabel
  /P (coverpage)
>>
endobj

6 0 obj
<<
  /Type /PageLabel
  /P (coverpbge)
>>
endobj

But when I set numbering:(..__)=>"cover" the PDF doesn't includes these /PageLabel.

Activity

  1. added
    feature request
    on May 29, 2026
  2. added
    pdf
    needs-investigation
    bug
    and removed
    feature request
    on May 29, 2026
  3. added
    feature request
    and removed
    bug
    needs-investigation
    on May 29, 2026
  4. changed the title [-]page numbering defined as `function` doesn't generate PageLabel[/-] [+]Page numbering defined as a function doesn't generate a PDF `/PageLabel`[/+] on May 29, 2026
  5. changed the title [-]Page numbering defined as a function doesn't generate a PDF `/PageLabel`[/-] [+]Generate PDF `/PageLabel` for page numbering defined as a function[/+] on May 29, 2026
  6. laurmaedje commented on May 29, 2026

    @laurmaedje
    Member

    The page labels are sort of best effort at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestpdf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions