Get creating outlines working again

This commit is contained in:
Kovid Goyal 2023-05-14 10:26:34 +05:30
parent 0517092f52
commit 541c1d2036
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -24,9 +24,8 @@ create_outline(PDFDoc *self, PyObject *args) {
try {
PdfString title = podofo_convert_pystring(title_buf);
PdfOutlines *outlines = self->doc->GetOutlines();
if (outlines == NULL) {PyErr_NoMemory(); return NULL;}
ans->item = outlines->CreateRoot(title);
PdfOutlines &outlines = self->doc->GetOrCreateOutlines();
ans->item = outlines.CreateRoot(title);
if (ans->item == NULL) {PyErr_NoMemory(); return NULL;}
ans->doc = self->doc;
auto page = get_page(self->doc, pagenum -1);