hpdf_doc.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * << Haru Free PDF Library >> -- hpdf_doc.h
  3. *
  4. * URL: http://libharu.org
  5. *
  6. * Copyright (c) 1999-2006 Takeshi Kanno <[email protected]>
  7. * Copyright (c) 2007-2009 Antony Dovgal <[email protected]>
  8. *
  9. * Permission to use, copy, modify, distribute and sell this software
  10. * and its documentation for any purpose is hereby granted without fee,
  11. * provided that the above copyright notice appear in all copies and
  12. * that both that copyright notice and this permission notice appear
  13. * in supporting documentation.
  14. * It is provided "as is" without express or implied warranty.
  15. *
  16. */
  17. #ifndef _HPDF_DOC_H
  18. #define _HPDF_DOC_H
  19. #define HPDF_SIG_BYTES 0x41504446L
  20. #include "hpdf_catalog.h"
  21. #include "hpdf_image.h"
  22. #include "hpdf_pages.h"
  23. #include "hpdf_outline.h"
  24. #include "hpdf_ext_gstate.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #define HPDF_VER_DEFAULT HPDF_VER_12
  29. typedef struct _HPDF_Doc_Rec {
  30. HPDF_UINT32 sig_bytes;
  31. HPDF_PDFVer pdf_version;
  32. HPDF_MMgr mmgr;
  33. HPDF_Catalog catalog;
  34. HPDF_Outline outlines;
  35. HPDF_Xref xref;
  36. HPDF_Pages root_pages;
  37. HPDF_Pages cur_pages;
  38. HPDF_Page cur_page;
  39. HPDF_List page_list;
  40. HPDF_Error_Rec error;
  41. HPDF_Dict info;
  42. HPDF_Dict trailer;
  43. HPDF_List font_mgr;
  44. HPDF_BYTE ttfont_tag[6];
  45. /* list for loaded fontdefs */
  46. HPDF_List fontdef_list;
  47. /* list for loaded encodings */
  48. HPDF_List encoder_list;
  49. HPDF_Encoder cur_encoder;
  50. /* default compression mode */
  51. HPDF_BOOL compression_mode;
  52. HPDF_BOOL encrypt_on;
  53. HPDF_EncryptDict encrypt_dict;
  54. HPDF_Encoder def_encoder;
  55. HPDF_UINT page_per_pages;
  56. HPDF_UINT cur_page_num;
  57. /* buffer for saving into memory stream */
  58. HPDF_Stream stream;
  59. } HPDF_Doc_Rec;
  60. typedef struct _HPDF_Doc_Rec *HPDF_Doc;
  61. HPDF_Encoder
  62. HPDF_Doc_FindEncoder (HPDF_Doc pdf,
  63. const char *encoding_name);
  64. HPDF_FontDef
  65. HPDF_Doc_FindFontDef (HPDF_Doc pdf,
  66. const char *font_name);
  67. HPDF_Font
  68. HPDF_Doc_FindFont (HPDF_Doc pdf,
  69. const char *font_name,
  70. const char *encoding_name);
  71. HPDF_BOOL
  72. HPDF_Doc_Validate (HPDF_Doc pdf);
  73. /*----- page handling -------------------------------------------------------*/
  74. HPDF_Pages
  75. HPDF_Doc_GetCurrentPages (HPDF_Doc pdf);
  76. HPDF_Pages
  77. HPDF_Doc_AddPagesTo (HPDF_Doc pdf,
  78. HPDF_Pages parent);
  79. HPDF_STATUS
  80. HPDF_Doc_SetCurrentPages (HPDF_Doc pdf,
  81. HPDF_Pages pages);
  82. HPDF_STATUS
  83. HPDF_Doc_SetCurrentPage (HPDF_Doc pdf,
  84. HPDF_Page page);
  85. /*----- font handling -------------------------------------------------------*/
  86. HPDF_FontDef
  87. HPDF_GetFontDef (HPDF_Doc pdf,
  88. const char *font_name);
  89. HPDF_STATUS
  90. HPDF_Doc_RegisterFontDef (HPDF_Doc pdf,
  91. HPDF_FontDef fontdef);
  92. /*----- encoding handling ---------------------------------------------------*/
  93. HPDF_STATUS
  94. HPDF_Doc_RegisterEncoder (HPDF_Doc pdf,
  95. HPDF_Encoder encoder);
  96. /*----- encryptio------------------------------------------------------------*/
  97. HPDF_STATUS
  98. HPDF_Doc_SetEncryptOn (HPDF_Doc pdf);
  99. HPDF_STATUS
  100. HPDF_Doc_SetEncryptOff (HPDF_Doc pdf);
  101. HPDF_STATUS
  102. HPDF_Doc_PrepareEncryption (HPDF_Doc pdf);
  103. #ifdef __cplusplus
  104. }
  105. #endif /* __cplusplus */
  106. #endif /* _HPDF_DOC_H */