Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

[GH 171] PageLabels do not support omitting legally-optional items

  • 1 Replies
  • 18 Views
*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 823
    • View Profile
hisdeedsaredust commented 03 Sep 2021

If "-style" is omitted from pageLabel(), decimal numbering is applied, by adding "/S /D" to the appropriate dictionary. However, according to the PDF 1.7 Specification, the "/S" key is optional, and if you want to make pages without a label, you would need to omit this.

I'm scanning old manuals that have covers and section dividers that are unnumbered, and I would like them to remain that way in the PDF. The only way I can see to do that at the moment is to hack the "/S" keys out afterwards:
Code: [Select]
$pdf->pageLabel(  0, { -prefix => 'blank' } );
$pdf->pageLabel(  2, { -style => 'roman' });
$pdf->pageLabel( 10, { -prefix => 'blank' });
$pdf->pageLabel( 12, { -style => 'decimal' });
$pdf->pageLabel( 42, { -prefix => 'blank' });
$pdf->pageLabel( 44, { -start => 31, -style => 'decimal' });
$pdf->pageLabel(140, { -prefix => 'blank' } );

# Hack away at the completed PageLabels number tree
foreach my $e ($pdf->{'catalog'}->{'PageLabels'}->{'Nums'}->elements()) {
    if (defined($e->{'P'}) && $e->{'P'}->val() eq 'blank') {
        undef $e->{'S'};
        undef $e->{'P'};
    }
}
PDF::Builder 3.022 (as packaged in Fedora 34)

*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 823
    • View Profile
Re: [GH 171] PageLabels do not support omitting legally-optional items
« Reply #1: September 12, 2021, 08:15:58 AM »
PhilterPaper replied 04 Sep 2021

Thank you for the report. I will take a look into this soon.

Just to be sure I understand what you're looking for, it appears that you have a 141+ page document. You are looking for the page label (reader's slider thumb value) to show:
Code: [Select]
- pages 0-1         label blank
- pages 2-9         label i-viii
- pages 10-11       label blank
- pages 12-41       label 1-29
- pages 42-43       label blank
- pages 44-139      label 31-127
- pages 140+        label blank

Is this correct? And what are you actually getting: a decimal page number where you want nothing (a blank)? Or something else? If it's insisting on adding a numeric page, that doesn't sound desirable.

You are looking to have the thumb label actually empty rather than saying some text? I don't know if PDF allows an empty label... if it doesn't, I'm guessing that a ' ' might be acceptable. I'm thinking of something along the lines of $pdf->pageLabel( 0, { -style => 'blank' } ); to show a blank label (if possible, I haven't experimented yet). Or possibly a -style of 'ptext' and use the -prefix text (which may be empty)? Would that work well for you?