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:
parent
8f2f7093d1
commit
d68d12cbfe
6
pdf.c
6
pdf.c
@ -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);
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
pdf_finalize_name_tree_node (tree, tree->root);
|
||||
struct pdf_name_tree *tree;
|
||||
|
||||
for (tree = pdf_file->name_tree_list; tree; tree = tree->next)
|
||||
pdf_finalize_name_tree_node (tree, tree->root);
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -26,9 +26,10 @@
|
||||
|
||||
struct pdf_name_tree
|
||||
{
|
||||
pdf_file_handle pdf_file;
|
||||
bool number_tree; /* false for name tree,
|
||||
true for number 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);
|
||||
|
||||
@ -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
|
||||
@ -47,13 +47,14 @@ struct pdf_pages
|
||||
|
||||
struct pdf_file
|
||||
{
|
||||
FILE *f;
|
||||
struct pdf_obj *first_ind_obj;
|
||||
struct pdf_obj *last_ind_obj;
|
||||
long int xref_offset;
|
||||
struct pdf_obj *catalog;
|
||||
struct pdf_obj *info;
|
||||
struct pdf_pages *root;
|
||||
struct pdf_bookmark *outline_root;
|
||||
struct pdf_obj *trailer_dict;
|
||||
FILE *f;
|
||||
struct pdf_obj *first_ind_obj;
|
||||
struct pdf_obj *last_ind_obj;
|
||||
long int xref_offset;
|
||||
struct pdf_obj *catalog;
|
||||
struct pdf_obj *info;
|
||||
struct pdf_pages *root;
|
||||
struct pdf_bookmark *outline_root;
|
||||
struct pdf_obj *trailer_dict;
|
||||
struct pdf_name_tree *name_tree_list;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user