1 /****************************************************************************** 2 Objects.h 3 4 Change Control: DDMMYYYY 5 Michael Still File created 03062000 6 7 Purpose: 8 This file lays out the object model that we use to describe the inside 9 of a PDF. We also define some constants we use internally to identify 10 certain kinds of objects. 11 ******************************************************************************/ 12 13 #ifndef PANDA_OBJECTS_H 14 #define PANDA_OBJECTS_H 1 15 16 #if defined _WINDOWS 17 #if defined _DEMO 18 #include "../panda/constants.h" 19 #else 20 #include "panda/constants.h" 21 #endif 22 #else 23 #include <panda/constants.h> 24 #endif 25 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 #include <stdio.h> 31 32 typedef struct panda_internal_object 33 { 34 int type; 35 int number; 36 int generation; 37 int textmode; 38 int insidegraphicsblock; 39 unsigned long byteOffset; 40 char *currentSetFont; 41 42 char *layoutstream, *binarystream; 43 char *layoutstreamFilename, *binarystreamFilename; 44 unsigned long layoutstreamLength, binarystreamLength; 45 46 void *children; 47 void *cachedLastChild; 48 49 int isPages; 50 int isContents; 51 int isPlaceholder; 52 53 char cascadeproperties[panda_object_property_max]; 54 char localproperties[panda_object_property_max]; 55 } 56 panda_object; 57 58 typedef struct panda_internal_page 59 { 60 panda_object *obj; 61 panda_object *contents; 62 63 int height; 64 int width; 65 int isTemplate; 66 } 67 panda_page; 68 69 typedef struct panda_internal_child 70 { 71 panda_object *me; 72 struct panda_internal_child *next; 73 } 74 panda_child; 75 76 typedef struct panda_internal_pagelist 77 { 78 panda_object *me; 79 struct panda_internal_pagelist *next; 80 } 81 panda_pagelist; 82 83 typedef struct panda_internal_xref 84 { 85 panda_object *me; 86 struct panda_internal_xref *next; 87 } 88 panda_xref; 89 90 typedef struct panda_internal_pdf 91 { 92 FILE *file; 93 panda_object *catalog, *pages, *fonts, *info, *linear; 94 unsigned long byteOffset, xrefOffset; 95 int nextObjectNumber, nextPHObjectNumber, pageCount, totalObjectNumber; 96 panda_xref *xrefList, *xrefTail; 97 int mode; 98 99 // This is needed for the tiff conversion 100 char *convertedTiff; 101 102 // These store the state of the drawing environment 103 char *currentFont; 104 int currentFontSize; 105 int currentFontMode; 106 double currentCharacterSpacing; 107 double currentWordSpacing; 108 double currentHorizontalScaling; 109 double currentLeading; 110 int nextFontNumber; 111 112 // This is a list of all of the pages allocated as pointers 113 panda_pagelist *pageholders; 114 115 // This is a dummy object for dumping objects 116 panda_object *dummyObj; 117 118 // Database for the internal representation of the PDF 119 void *db; 120 } 121 panda_pdf; 122 123 //#if defined _WINDOWS 124 // typedef struct windows_panda_internal_ptrlist 125 // { 126 // void *me; 127 // int number; 128 // struct windows_panda_internal_ptrlist *next; 129 // } 130 // windows_panda_ptrlist; 131 132 // typedef struct windows_panda_internal_abs 133 // { 134 // int highest; 135 // windows_panda_ptrlist *list; 136 // } 137 // windows_panda_abs; 138 //#endif 139 #ifdef __cplusplus 140 } 141 #endif 142 143 typedef struct panda_internal_fontmetric 144 { 145 char *fontName; 146 int characterWidth[256]; 147 } 148 panda_fontmetric; 149 150 #endif /* PANDA_OBJECTS_H */ 151