CGPDFDocument.pas 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. { CoreGraphics - CGPDFDocument.h
  2. * Copyright (c) 2000-2003 Apple Computer, Inc.
  3. * All rights reserved.
  4. }
  5. { Pascal Translation: Peter N Lewis, <[email protected]>, August 2005 }
  6. {
  7. Modified for use with Free Pascal
  8. Version 200
  9. Please report any bugs to <[email protected]>
  10. }
  11. {$mode macpas}
  12. {$packenum 1}
  13. {$macro on}
  14. {$inline on}
  15. {$CALLING MWPASCAL}
  16. unit CGPDFDocument;
  17. interface
  18. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  19. {$setc GAP_INTERFACES_VERSION := $0200}
  20. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  21. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  22. {$endc}
  23. {$ifc defined CPUPOWERPC and defined CPUI386}
  24. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  25. {$endc}
  26. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  27. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  28. {$endc}
  29. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  30. {$setc __ppc__ := 1}
  31. {$elsec}
  32. {$setc __ppc__ := 0}
  33. {$endc}
  34. {$ifc not defined __i386__ and defined CPUI386}
  35. {$setc __i386__ := 1}
  36. {$elsec}
  37. {$setc __i386__ := 0}
  38. {$endc}
  39. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  40. {$error Conflicting definitions for __ppc__ and __i386__}
  41. {$endc}
  42. {$ifc defined __ppc__ and __ppc__}
  43. {$setc TARGET_CPU_PPC := TRUE}
  44. {$setc TARGET_CPU_X86 := FALSE}
  45. {$elifc defined __i386__ and __i386__}
  46. {$setc TARGET_CPU_PPC := FALSE}
  47. {$setc TARGET_CPU_X86 := TRUE}
  48. {$elsec}
  49. {$error Neither __ppc__ nor __i386__ is defined.}
  50. {$endc}
  51. {$setc TARGET_CPU_PPC_64 := FALSE}
  52. {$ifc defined FPC_BIG_ENDIAN}
  53. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  54. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  55. {$elifc defined FPC_LITTLE_ENDIAN}
  56. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  57. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  58. {$elsec}
  59. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  60. {$endc}
  61. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  62. {$setc CALL_NOT_IN_CARBON := FALSE}
  63. {$setc OLDROUTINENAMES := FALSE}
  64. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  65. {$setc OPAQUE_UPP_TYPES := TRUE}
  66. {$setc OTCARBONAPPLICATION := TRUE}
  67. {$setc OTKERNEL := FALSE}
  68. {$setc PM_USE_SESSION_APIS := TRUE}
  69. {$setc TARGET_API_MAC_CARBON := TRUE}
  70. {$setc TARGET_API_MAC_OS8 := FALSE}
  71. {$setc TARGET_API_MAC_OSX := TRUE}
  72. {$setc TARGET_CARBON := TRUE}
  73. {$setc TARGET_CPU_68K := FALSE}
  74. {$setc TARGET_CPU_MIPS := FALSE}
  75. {$setc TARGET_CPU_SPARC := FALSE}
  76. {$setc TARGET_OS_MAC := TRUE}
  77. {$setc TARGET_OS_UNIX := FALSE}
  78. {$setc TARGET_OS_WIN32 := FALSE}
  79. {$setc TARGET_RT_MAC_68881 := FALSE}
  80. {$setc TARGET_RT_MAC_CFM := FALSE}
  81. {$setc TARGET_RT_MAC_MACHO := TRUE}
  82. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  83. {$setc TYPE_BOOL := FALSE}
  84. {$setc TYPE_EXTENDED := FALSE}
  85. {$setc TYPE_LONGLONG := TRUE}
  86. uses MacTypes,CFBase,CGBase,CGDataProvider,CGGeometry,CFURL;
  87. {$ALIGN POWER}
  88. type
  89. CGPDFDocumentRef = ^SInt32; { an opaque 32-bit type }
  90. { Create a PDF document, using `provider' to obtain the document's
  91. * data. }
  92. function CGPDFDocumentCreateWithProvider( provider: CGDataProviderRef ): CGPDFDocumentRef; external name '_CGPDFDocumentCreateWithProvider';
  93. { Create a PDF document from `url'. }
  94. function CGPDFDocumentCreateWithURL( url: CFURLRef ): CGPDFDocumentRef; external name '_CGPDFDocumentCreateWithURL';
  95. { Equivalent to `CFRetain(document)', except it doesn't crash (as CFRetain
  96. * does) if `document' is NULL. }
  97. function CGPDFDocumentRetain( document: CGPDFDocumentRef ): CGPDFDocumentRef; external name '_CGPDFDocumentRetain';
  98. { Equivalent to `CFRelease(document)', except it doesn't crash (as
  99. * CFRelease does) if `document' is NULL. }
  100. procedure CGPDFDocumentRelease( document: CGPDFDocumentRef ); external name '_CGPDFDocumentRelease';
  101. { Return the major and minor version numbers of `document'. }
  102. procedure CGPDFDocumentGetVersion( document: CGPDFDocumentRef; var majorVersion: SInt32; var minorVersion: SInt32 ); external name '_CGPDFDocumentGetVersion'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  103. { Return true if the PDF file associated with `document' is encrypted;
  104. * false otherwise. If the PDF file is encrypted, then a password must be
  105. * supplied before certain operations are enabled; different passwords may
  106. * enable different operations. }
  107. function CGPDFDocumentIsEncrypted( document: CGPDFDocumentRef ): CBool; external name '_CGPDFDocumentIsEncrypted'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  108. { Use `password' to decrypt `document' and grant permission for certain
  109. * operations. Returns true if `password' is a valid password; false
  110. * otherwise. }
  111. function CGPDFDocumentUnlockWithPassword( document: CGPDFDocumentRef; password: ConstCStringPtr ): CBool; external name '_CGPDFDocumentUnlockWithPassword'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  112. { Return true if `document' is unlocked; false otherwise. A document is
  113. * unlocked if it isn't encrypted, or if it is encrypted and a valid password
  114. * was previously specified with CGPDFDocumentUnlockWithPassword. }
  115. function CGPDFDocumentIsUnlocked( document: CGPDFDocumentRef ): CBool; external name '_CGPDFDocumentIsUnlocked'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  116. { Return true if `document' allows printing; false otherwise. Typically,
  117. * this function returns false only if the document is encrypted and the
  118. * document's current password doesn't grant permission to perform
  119. * printing. }
  120. function CGPDFDocumentAllowsPrinting( document: CGPDFDocumentRef ): CBool; external name '_CGPDFDocumentAllowsPrinting'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  121. { Return true if `document' allows copying; false otherwise. Typically,
  122. * this function returns false only if the document is encrypted and the
  123. * document's current password doesn't grant permission to perform
  124. * copying. }
  125. function CGPDFDocumentAllowsCopying( document: CGPDFDocumentRef ): CBool; external name '_CGPDFDocumentAllowsCopying'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  126. { Return the number of pages in `document'. }
  127. function CGPDFDocumentGetNumberOfPages( document: CGPDFDocumentRef ): size_t; external name '_CGPDFDocumentGetNumberOfPages';
  128. { Return the page corresponding to `pageNumber', or NULL if no such page
  129. * exists in the document. Pages are numbered starting at 1. }
  130. function CGPDFDocumentGetPage( document: CGPDFDocumentRef; pageNumber: size_t ): CGPDFPageRef; external name '_CGPDFDocumentGetPage'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  131. { Return the document catalog of `document'. }
  132. function CGPDFDocumentGetCatalog( document: CGPDFDocumentRef ): CGPDFDictionaryRef; external name '_CGPDFDocumentGetCatalog'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  133. { Return the info dictionary of `document'. }
  134. function CGPDFDocumentGetInfo( document: CGPDFDocumentRef ): CGPDFDictionaryRef; external name '_CGPDFDocumentGetInfo'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  135. { Return the "file identifier" of `document'. }
  136. function CGPDFDocumentGetID( document: CGPDFDocumentRef ): CGPDFArrayRef; external name '_CGPDFDocumentGetID'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  137. { Return the CFTypeID for CGPDFDocumentRefs. }
  138. function CGPDFDocumentGetTypeID: CFTypeID; external name '_CGPDFDocumentGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  139. { The following functions are deprecated in favor of the CGPDFPage API. }
  140. { DEPRECATED; return the media box of page number `page' in `document'. }
  141. function CGPDFDocumentGetMediaBox( document: CGPDFDocumentRef; page: SInt32 ): CGRect; external name '_CGPDFDocumentGetMediaBox';
  142. { DEPRECATED; return the crop box of page number `page' in `document'. }
  143. function CGPDFDocumentGetCropBox( document: CGPDFDocumentRef; page: SInt32 ): CGRect; external name '_CGPDFDocumentGetCropBox';
  144. { DEPRECATED; return the bleed box of page number `page' in `document'. }
  145. function CGPDFDocumentGetBleedBox( document: CGPDFDocumentRef; page: SInt32 ): CGRect; external name '_CGPDFDocumentGetBleedBox';
  146. { DEPRECATED; return the trim box of page number `page' in `document'. }
  147. function CGPDFDocumentGetTrimBox( document: CGPDFDocumentRef; page: SInt32 ): CGRect; external name '_CGPDFDocumentGetTrimBox';
  148. { DEPRECATED; return the art box of page number `page' in `document'. }
  149. function CGPDFDocumentGetArtBox( document: CGPDFDocumentRef; page: SInt32 ): CGRect; external name '_CGPDFDocumentGetArtBox';
  150. { DEPRECATED; return the rotation angle (in degrees) of page number `page'
  151. * in `document'. }
  152. function CGPDFDocumentGetRotationAngle( document: CGPDFDocumentRef; page: SInt32 ): SInt32; external name '_CGPDFDocumentGetRotationAngle';
  153. end.