I've been working on an application in C# using WinForms and the PDFsharp library. The goal is to create a PDF file with a specified page label. I first saved a given string as the file name, then attempted to use a different string as the PageLabel. I tried properly setting the page label within the PDF document using PDFsharp, but faced challenges in getting the page label metadata in the correct location within the PDF structure.
I tried setting the page label using the PdfDictionary and PdfArray objects, but the label was not inserted in the correct location. Next, made adjustments to the code and attempted to modify the Pages dictionary rather than the Catalog dictionary, but still didn't achieve the desired result. I then further tried correcting the code to create and add the PdfDictionary and PdfArray objects in the right sequence, but still didn't achieve the desired metadata structure for the page labels.
Is there a way to do this using PDFSharp? Two of us have been working on this problem for days and while we're understanding a bit more of what goes where, we can't seem to solve this problem.