unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.54k stars 250 forks source link

[FEATURE] Support adding PageLabels to new PDF #323

Closed ahawtho closed 4 years ago

ahawtho commented 4 years ago

Is your feature request related to a problem? Please describe. N/A

Describe the solution you'd like Currently, there doesn't appear to be a way to add the optional PageLabels number tree to the catalog object on write, as it's not accessible when creating a new PDF. The simplest approach would be to an API to add a PdfObjectDictionary to the catalog node created by a PdfWriter.

Describe alternatives you've considered Manually creating PDFs, hand-editing, etc..

Additional context https://www.adobe.com/content/dam/acom/en/devnet/pdf/PDF32000_2008.pdf section 12.4.2 for reference.

gunnsth commented 4 years ago

@ahawtho Thanks for reporting. We have a PR in preparation for this: #325. Can you check if it suits your use case?

gunnsth commented 4 years ago

@ahawtho This is supported in v3.6.2

ahawtho commented 4 years ago

@gunnsth this suffices for us. The main use case is generating PDFs with PageLabels for test data. We also may be copying PageLabel data when splitting a PDF.