filename = dupstr("output.pdf");
for (p = sourceform; p; p = p->next) {
- if (p->type == para_Config && p->parent) {
+ if (p->type == para_Config) {
if (!ustricmp(p->keyword, L"pdf-filename")) {
sfree(filename);
filename = dupstr(adv(p->origkeyword));
olist.number = 1;
cat = new_object(&olist);
- outlines = new_object(&olist);
+ if (doc->n_outline_elements > 0)
+ outlines = new_object(&olist);
+ else
+ outlines = NULL;
pages = new_object(&olist);
resources = new_object(&olist);
* The catalogue just contains references to the outlines and
* pages objects.
*/
- objtext(cat, "<<\n/Type /Catalog\n/Outlines ");
- objref(cat, outlines);
+ objtext(cat, "<<\n/Type /Catalog");
+ if (outlines) {
+ objtext(cat, "\n/Outlines ");
+ objref(cat, outlines);
+ }
objtext(cat, "\n/Pages ");
objref(cat, pages);
- objtext(cat, "\n/PageMode /UseOutlines\n>>\n");
+ if (outlines)
+ objtext(cat, "\n/PageMode /UseOutlines");
+ objtext(cat, "\n>>\n");
/*
* Set up the resources dictionary, which mostly means
/*
* Set up the outlines dictionary.
*/
- {
+ if (outlines) {
int topcount;
char buf[80];
static object *new_object(objlist *list)
{
- object *obj = mknew(object);
+ object *obj = snew(object);
obj->list = list;