1
0
mirror of synced 2026-01-13 15:27:55 +00:00

add linked list of name trees to struct pdf_file, and finalize all name trees when PDF file is closed.

This commit is contained in:
Eric Smith 2003-03-08 06:52:09 +00:00
parent 8f2f7093d1
commit d68d12cbfe
4 changed files with 31 additions and 19 deletions

6
pdf.c
View File

@ -4,7 +4,7 @@
* will be compressed using ITU-T T.6 (G4) fax encoding.
*
* PDF routines
* $Id: pdf.c,v 1.5 2003/03/04 18:09:49 eric Exp $
* $Id: pdf.c,v 1.6 2003/03/07 22:52:09 eric Exp $
* Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@ -35,6 +35,7 @@
#include "pdf_util.h"
#include "pdf_prim.h"
#include "pdf_private.h"
#include "pdf_name_tree.h"
static void pdf_set_info (pdf_file_handle pdf_file, char *key, char *val)
@ -113,6 +114,9 @@ pdf_file_handle pdf_create (char *filename, int page_mode)
void pdf_close (pdf_file_handle pdf_file)
{
/* finalize all data structures */
pdf_finalize_name_trees (pdf_file);
/* write body */
pdf_write_all_ind_obj (pdf_file);

View File

@ -4,7 +4,7 @@
* will be compressed using ITU-T T.6 (G4) fax encoding.
*
* PDF routines
* $Id: pdf_name_tree.c,v 1.3 2003/03/07 03:35:36 eric Exp $
* $Id: pdf_name_tree.c,v 1.4 2003/03/07 22:52:09 eric Exp $
* Copyright 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@ -80,6 +80,9 @@ struct pdf_name_tree *pdf_new_name_tree (pdf_file_handle pdf_file,
root->parent = NULL;
root->leaf = 1;
tree->next = pdf_file->name_tree_list;
pdf_file->name_tree_list = tree;
return (tree);
}
@ -248,7 +251,10 @@ static void pdf_finalize_name_tree_node (struct pdf_name_tree *tree,
}
void pdf_finalize_name_tree (struct pdf_name_tree *tree)
void pdf_finalize_name_trees (pdf_file_handle pdf_file)
{
struct pdf_name_tree *tree;
for (tree = pdf_file->name_tree_list; tree; tree = tree->next)
pdf_finalize_name_tree_node (tree, tree->root);
}

View File

@ -4,7 +4,7 @@
* will be compressed using ITU-T T.6 (G4) fax encoding.
*
* PDF routines
* $Id: pdf_name_tree.h,v 1.1 2003/03/07 02:16:08 eric Exp $
* $Id: pdf_name_tree.h,v 1.2 2003/03/07 22:52:09 eric Exp $
* Copyright 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@ -27,6 +27,7 @@
struct pdf_name_tree
{
pdf_file_handle pdf_file;
struct pdf_name_tree *next; /* chain all name trees in the PDF file */
bool number_tree; /* false for name tree,
true for number tree */
struct pdf_name_tree_node *root;
@ -47,4 +48,4 @@ void pdf_add_number_tree_element (struct pdf_name_tree *tree,
struct pdf_obj *val);
void pdf_finalize_name_tree (struct pdf_name_tree *tree);
void pdf_finalize_name_trees (pdf_file_handle pdf_file);

View File

@ -4,7 +4,7 @@
* will be compressed using ITU-T T.6 (G4) fax encoding.
*
* PDF routines
* $Id: pdf_private.h,v 1.5 2003/03/05 12:56:25 eric Exp $
* $Id: pdf_private.h,v 1.6 2003/03/07 22:52:09 eric Exp $
* Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@ -56,4 +56,5 @@ struct pdf_file
struct pdf_pages *root;
struct pdf_bookmark *outline_root;
struct pdf_obj *trailer_dict;
struct pdf_name_tree *name_tree_list;
};