spire-pdf 11.7.0__py3-none-macosx_10_7_universal.whl → 11.9.2__py3-none-macosx_10_7_universal.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of spire-pdf might be problematic. Click here for more details.

@@ -1,1760 +0,0 @@
1
- from enum import Enum
2
- from plum import dispatch
3
- from typing import TypeVar,Union,Generic,List,Tuple,overload
4
- from spire.pdf.common import *
5
- from spire.pdf import *
6
- from ctypes import *
7
- import abc
8
-
9
- class PdfDocument (SpireObject) :
10
- """
11
-
12
- """
13
- """Initializes a new instance of the class.
14
-
15
- """
16
- @dispatch
17
- def __init__(self):
18
- GetDllLibPdf().PdfDocument_Create.restype = c_void_p
19
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_Create)
20
- super(PdfDocument, self).__init__(intPtr)
21
- @dispatch
22
- def __init__(self, filename:str):
23
- GetDllLibPdf().PdfDocument_CreatePdfDocumentF.argtypes=[c_wchar_p]
24
- GetDllLibPdf().PdfDocument_CreatePdfDocumentF.restype = c_void_p
25
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_CreatePdfDocumentF,filename)
26
- super(PdfDocument, self).__init__(intPtr)
27
- @dispatch
28
- def __init__(self, filename:str, password:str):
29
- GetDllLibPdf().PdfDocument_CreatePdfDocumentFP.argtypes=[c_wchar_p,c_wchar_p]
30
- GetDllLibPdf().PdfDocument_CreatePdfDocumentFP.restype = c_void_p
31
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_CreatePdfDocumentFP,filename,password)
32
- super(PdfDocument, self).__init__(intPtr)
33
- @dispatch
34
- def __init__(self, stream:Stream):
35
- intPtrstream:c_void_p = stream.Ptr
36
- GetDllLibPdf().PdfDocument_CreatePdfDocumentS.argtypes=[c_void_p]
37
- GetDllLibPdf().PdfDocument_CreatePdfDocumentS.restype = c_void_p
38
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_CreatePdfDocumentS,intPtrstream)
39
- super(PdfDocument, self).__init__(intPtr)
40
- @dispatch
41
- def __init__(self, stream:Stream, password:str):
42
- intPtrstream:c_void_p = stream.Ptr
43
- GetDllLibPdf().PdfDocument_CreatePdfDocumentSP.argtypes=[c_void_p,c_wchar_p]
44
- GetDllLibPdf().PdfDocument_CreatePdfDocumentSP.restype = c_void_p
45
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_CreatePdfDocumentSP,intPtrstream,password)
46
- super(PdfDocument, self).__init__(intPtr)
47
- def __del__(self):
48
- GetDllLibPdf().PdfDocument_Dispose.argtypes = [c_void_p]
49
- CallCFunction(GetDllLibPdf().PdfDocument_Dispose,self.Ptr)
50
- super(PdfDocument, self).__del__()
51
- # @dispatch
52
- #
53
- # def LoadFromBytes(self ,bytes:'Byte[]',password:str):
54
- # """
55
- # <summary>
56
- # Initializes a new instance of the class.
57
- # </summary>
58
- # <param name="bytes">The byte array with the file content.</param>
59
- # <param name="password">The password (user or owner) of the encrypted document.</param>
60
- # """
61
- # #arraybytes:ArrayTypebytes = ""
62
- # countbytes = len(bytes)
63
- # ArrayTypebytes = c_void_p * countbytes
64
- # arraybytes = ArrayTypebytes()
65
- # for i in range(0, countbytes):
66
- # arraybytes[i] = bytes[i].Ptr
67
- #
68
- #
69
- # GetDllLibPdf().PdfDocument_LoadFromBytes.argtypes=[c_void_p ,ArrayTypebytes,c_wchar_p]
70
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromBytes,self.Ptr, arraybytes,password)
71
-
72
-
73
- @dispatch
74
-
75
- def LoadFromStream(self ,stream:Stream,password:str):
76
- """
77
- Initializes a new instance.
78
-
79
- Args:
80
- stream (Stream): The stream with the file.
81
- password (str): The password (user or owner) of the encrypted document.
82
- """
83
- intPtrstream:c_void_p = stream.Ptr
84
-
85
- GetDllLibPdf().PdfDocument_LoadFromStreamSP.argtypes=[c_void_p ,c_void_p,c_wchar_p]
86
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromStreamSP,self.Ptr, intPtrstream,password)
87
-
88
- @dispatch
89
-
90
- def CreateBooklet(self ,fileName:str,width:float,height:float,bothSides:bool):
91
- """
92
- Thie method creates a booklet
93
-
94
- Args:
95
- fileName (str): The loaded document filename.
96
- width (float): The page width.
97
- height (float): The page height.
98
- bothSides (bool): if set to <c>true</c> if the result in document should be printed.
99
- """
100
- GetDllLibPdf().PdfDocument_CreateBooklet.argtypes=[c_void_p ,c_wchar_p,c_float,c_float,c_bool]
101
- CallCFunction(GetDllLibPdf().PdfDocument_CreateBooklet,self.Ptr, fileName,width,height,bothSides)
102
-
103
- @dispatch
104
-
105
- def VerifySignature(self ,signName:str)->bool:
106
- """
107
- Verify pdf document regarding signature.
108
-
109
- Args:
110
- signName (str): Signature field name.
111
-
112
- Returns:
113
- bool: Signature is validated return true,otherwise false
114
- """
115
-
116
- GetDllLibPdf().PdfDocument_VerifySignature.argtypes=[c_void_p ,c_wchar_p]
117
- GetDllLibPdf().PdfDocument_VerifySignature.restype=c_bool
118
- ret = CallCFunction(GetDllLibPdf().PdfDocument_VerifySignature,self.Ptr, signName)
119
- return ret
120
-
121
- #
122
- # def GetSignatureContent(self ,signName:str)->List['Byte']:
123
- # """
124
- # <summary>
125
- # Get pdf document regarding signature.
126
- # </summary>
127
- # <param name="signName">Signature field name.</param>
128
- # """
129
- #
130
- # GetDllLibPdf().PdfDocument_GetSignatureContent.argtypes=[c_void_p ,c_wchar_p]
131
- # GetDllLibPdf().PdfDocument_GetSignatureContent.restype=IntPtrArray
132
- # intPtrArray = CallCFunction(GetDllLibPdf().PdfDocument_GetSignatureContent,self.Ptr, signName)
133
- # ret = GetObjVectorFromArray(intPtrArray, Byte)
134
- # return ret
135
-
136
-
137
- @staticmethod
138
-
139
- def IsPasswordProtected(fileName:str)->bool:
140
- """
141
- Whether the file is password protected.
142
-
143
- Args:
144
- fileName (str): The file name.
145
-
146
- Returns:
147
- bool: if password protected,return true,or false
148
- """
149
- intPtrDoc = None
150
- GetDllLibPdf().PdfDocument_IsPasswordProtected.argtypes=[ c_void_p,c_wchar_p]
151
- GetDllLibPdf().PdfDocument_IsPasswordProtected.restype=c_bool
152
- ret = CallCFunction(GetDllLibPdf().PdfDocument_IsPasswordProtected, intPtrDoc,fileName)
153
- return ret
154
-
155
- def HasExtendedRight(self)->bool:
156
- """
157
- Indicates whthere contains extended right.
158
- """
159
- GetDllLibPdf().PdfDocument_HasExtendedRight.argtypes=[c_void_p]
160
- GetDllLibPdf().PdfDocument_HasExtendedRight.restype=c_bool
161
- ret = CallCFunction(GetDllLibPdf().PdfDocument_HasExtendedRight,self.Ptr)
162
- return ret
163
-
164
- def RemoveExtendedRight(self):
165
- """
166
- Removes the extended right.
167
- """
168
- GetDllLibPdf().PdfDocument_RemoveExtendedRight.argtypes=[c_void_p]
169
- CallCFunction(GetDllLibPdf().PdfDocument_RemoveExtendedRight,self.Ptr)
170
-
171
- @dispatch
172
-
173
- def SaveToStream(self ,stream:Stream):
174
- """
175
- Save the document to the specified stream.
176
-
177
- Args:
178
- stream (Stream): The stream which default saved to the FileFormat.PDF format.
179
- """
180
- intPtrstream:c_void_p = stream.Ptr
181
-
182
- GetDllLibPdf().PdfDocument_SaveToStream.argtypes=[c_void_p ,c_void_p]
183
- CallCFunction(GetDllLibPdf().PdfDocument_SaveToStream,self.Ptr, intPtrstream)
184
-
185
- # @dispatch
186
- #
187
- # def SaveToStream(self ,fileformat:FileFormat)->List[Stream]:
188
- # """
189
- # <summary>
190
- # Convert the document to streams with the file format.
191
- # </summary>
192
- # <param name="fileformat">The file format.</param>
193
- # <returns>
194
- # The format file streams.
195
- # FileFormat.PDF:return only one stream(PDF support paging).
196
- # FileFormat.XPS:return only one stream(XPS support paging).
197
- # FileFormat.DOC:return only one stream(DOC support paging).
198
- # FileFormat.DOCX:return only one stream(DOCX support paging).
199
- # FileFormat.XLSX:return only one stream(XLSX support paging).
200
- # FileFormat.PCL:return only one stream(PCL support paging).
201
- # FileFormat.POSTSCRIPT:return only one stream(POSTSCRIPT support paging).
202
- # FileFormat.HTML:return only one stream(HTML support paging).
203
- # FileFormat.SVG:return multiple streams(SVG not support paging,one stream to one page).
204
- # </returns>
205
- # """
206
- # enumfileformat:c_int = fileformat.value
207
- #
208
- # GetDllLibPdf().PdfDocument_SaveToStreamF.argtypes=[c_void_p ,c_int]
209
- # GetDllLibPdf().PdfDocument_SaveToStreamF.restype=IntPtrArray
210
- # intPtrArray = CallCFunction(GetDllLibPdf().PdfDocument_SaveToStreamF,self.Ptr, enumfileformat)
211
- # ret = GetObjVectorFromArray(intPtrArray, Stream)
212
- # return ret
213
-
214
-
215
- # @dispatch
216
- #
217
- # def SaveToStream(self ,startIndex:int,endIndex:int,fileformat:FileFormat)->List[Stream]:
218
- # """
219
- # <summary>
220
- # Convert the document to streams with the file format.
221
- # </summary>
222
- # <param name="startIndex">The start index.</param>
223
- # <param name="endIndex">The end index.</param>
224
- # <param name="fileformat">The file format.</param>
225
- # <returns>
226
- # The format file streams.
227
- # FileFormat.PDF:return only one stream(PDF support paging).
228
- # FileFormat.XPS:return only one stream(XPS support paging).
229
- # FileFormat.DOC:return only one stream(DOC support paging).
230
- # FileFormat.DOCX:return only one stream(DOCX support paging).
231
- # FileFormat.XLSX:return only one stream(XLSX support paging).
232
- # FileFormat.PCL:return only one stream(PCL support paging).
233
- # FileFormat.POSTSCRIPT:return only one stream(POSTSCRIPT support paging).
234
- # FileFormat.HTML:return only one stream(HTML support paging).
235
- # FileFormat.SVG:return multiple streams(SVG not support paging,one stream to one page).
236
- # </returns>
237
- # """
238
- # enumfileformat:c_int = fileformat.value
239
- #
240
- # GetDllLibPdf().PdfDocument_SaveToStreamSEF.argtypes=[c_void_p ,c_int,c_int,c_int]
241
- # GetDllLibPdf().PdfDocument_SaveToStreamSEF.restype=IntPtrArray
242
- # intPtrArray = CallCFunction(GetDllLibPdf().PdfDocument_SaveToStreamSEF,self.Ptr, startIndex,endIndex,enumfileformat)
243
- # ret = GetObjVectorFromArray(intPtrArray, Stream)
244
- # return ret
245
-
246
-
247
- @dispatch
248
-
249
- def SaveToStream(self ,stream:Stream,fileformat:FileFormat):
250
- """
251
- Convert the document to an stream with the file format.
252
-
253
- Args:
254
- stream (Stream): The stream with the file format.
255
- fileformat (FileFormat): The file format.FileFormat.SVG is not supported, because SVG file has no paging,so can't be saved to a stream.
256
- """
257
- intPtrstream:c_void_p = stream.Ptr
258
- enumfileformat:c_int = fileformat.value
259
-
260
- GetDllLibPdf().PdfDocument_SaveToStreamSF.argtypes=[c_void_p ,c_void_p,c_int]
261
- CallCFunction(GetDllLibPdf().PdfDocument_SaveToStreamSF,self.Ptr, intPtrstream,enumfileformat)
262
-
263
- @dispatch
264
-
265
- def SaveToFile(self ,filename:str):
266
- """
267
- Saves PDF document to file.
268
-
269
- Args:
270
- filename (str): A relative or absolute path for the file.
271
- """
272
- print(filename)
273
- GetDllLibPdf().PdfDocument_SaveToFile.argtypes=[c_void_p ,c_wchar_p]
274
- CallCFunction(GetDllLibPdf().PdfDocument_SaveToFile,self.Ptr, filename)
275
-
276
- @dispatch
277
-
278
- def SaveToFile(self ,filename:str,fileFormat:FileFormat):
279
- """
280
- Saves PDF document to file.
281
-
282
- Args:
283
- filename (str): A relative or absolute path for the file.
284
- fileFormat (FileFormat): File format for the file.
285
- """
286
- enumfileFormat:c_int = fileFormat.value
287
-
288
- GetDllLibPdf().PdfDocument_SaveToFileFF.argtypes=[c_void_p ,c_wchar_p,c_int]
289
- CallCFunction(GetDllLibPdf().PdfDocument_SaveToFileFF,self.Ptr, filename,enumfileFormat)
290
-
291
- @dispatch
292
-
293
- def SaveToFile(self ,filename:str,startIndex:int,endIndex:int,fileFormat:FileFormat):
294
- """
295
- Saves PDF document to PDF or other Format files.
296
- Current only supports save PDF document to SVG and PDF
297
-
298
- Args:
299
- filename (str): A relative or absolute path for the file.
300
- startIndex (int): The start page index.The index starts at 0.
301
- endIndex (int): The end page index.
302
- fileFormat (FileFormat): File format for the file.
303
- """
304
- enumfileFormat:c_int = fileFormat.value
305
-
306
- GetDllLibPdf().PdfDocument_SaveToFileFSEF.argtypes=[c_void_p ,c_wchar_p,c_int,c_int,c_int]
307
- CallCFunction(GetDllLibPdf().PdfDocument_SaveToFileFSEF,self.Ptr, filename,startIndex,endIndex,enumfileFormat)
308
-
309
- @dispatch
310
-
311
- def SaveAsImage(self ,pageIndex:int)->Stream:
312
- """
313
- Saves PDF document page as image
314
-
315
- Args:
316
- pageIndex (int): Page with page index to save as image.
317
- Returns:
318
- Stream: Returns page as Image.
319
- """
320
- GetDllLibPdf().PdfDocument_SaveAsImage.argtypes=[c_void_p ,c_int]
321
- GetDllLibPdf().PdfDocument_SaveAsImage.restype=c_void_p
322
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_SaveAsImage,self.Ptr, pageIndex)
323
- ret = None if intPtr==None else Stream(intPtr)
324
- return ret
325
-
326
-
327
- #@dispatch
328
-
329
- #def SaveAsImage(self ,pageIndex:int,dpiX:int,dpiY:int)->Image:
330
- # """
331
- #<summary>
332
- # Saves PDF document page as image,Set image Dpi
333
- #</summary>
334
- #<param name="pageIndex">Page with page index to save as image</param>
335
- #<param name="dpiX">Pictures X resolution</param>
336
- #<param name="dpiY">Pictures Y resolution</param>
337
- #<returns>Returns page as Image</returns>
338
- # """
339
-
340
- # GetDllLibPdf().PdfDocument_SaveAsImagePDD.argtypes=[c_void_p ,c_int,c_int,c_int]
341
- # GetDllLibPdf().PdfDocument_SaveAsImagePDD.restype=c_void_p
342
- # intPtr = CallCFunction(GetDllLibPdf().PdfDocument_SaveAsImagePDD,self.Ptr, pageIndex,dpiX,dpiY)
343
- # ret = None if intPtr==None else Image(intPtr)
344
- # return ret
345
-
346
-
347
- #@dispatch
348
-
349
- #def SaveAsImage(self ,pageIndex:int,type:PdfImageType,dpiX:int,dpiY:int)->Image:
350
- # """
351
- #<summary>
352
- # Saves PDF document page as image,Set PdfImageType and image Dpi
353
- #</summary>
354
- #<param name="pageIndex">Page index</param>
355
- #<param name="type">PdfImageType type </param>
356
- #<param name="dpiX">
357
- # X resolution
358
- #</param>
359
- #<param name="dpiY">
360
- # Y resolution
361
- #</param>
362
- #<returns>Returns page as Image</returns>
363
- # """
364
- # enumtype:c_int = type.value
365
-
366
- # GetDllLibPdf().PdfDocument_SaveAsImagePTDD.argtypes=[c_void_p ,c_int,c_int,c_int,c_int]
367
- # GetDllLibPdf().PdfDocument_SaveAsImagePTDD.restype=c_void_p
368
- # intPtr = CallCFunction(GetDllLibPdf().PdfDocument_SaveAsImagePTDD,self.Ptr, pageIndex,enumtype,dpiX,dpiY)
369
- # ret = None if intPtr==None else Image(intPtr)
370
- # return ret
371
-
372
-
373
- @dispatch
374
-
375
- def SaveAsImage(self ,pageIndex:int,type:PdfImageType)->Stream:
376
- """
377
- Saves PDF document page as image
378
-
379
- Args:
380
- pageIndex (int): Page with page index to save as image.
381
- type (PdfImageType): PdfImageType type.
382
- Returns:
383
- Stream: Returns page as Image.
384
- """
385
- enumtype:c_int = type.value
386
-
387
- GetDllLibPdf().PdfDocument_SaveAsImagePT.argtypes=[c_void_p ,c_int,c_int]
388
- GetDllLibPdf().PdfDocument_SaveAsImagePT.restype=c_void_p
389
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_SaveAsImagePT,self.Ptr, pageIndex,enumtype)
390
- ret = None if intPtr==None else Stream(intPtr)
391
- return ret
392
-
393
-
394
-
395
- def Clone(self)->'SpireObject':
396
- """
397
- Creates a new object that is a copy of the current instance.
398
- The resulting clone must be of the same type as or a compatible type to the original instance.
399
- """
400
- GetDllLibPdf().PdfDocument_Clone.argtypes=[c_void_p]
401
- GetDllLibPdf().PdfDocument_Clone.restype=c_void_p
402
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_Clone,self.Ptr)
403
- ret = None if intPtr==None else SpireObject(intPtr)
404
- return ret
405
-
406
- @dispatch
407
- def Encrypt(self ,securityPolicy:PdfSecurityPolicy):
408
- """
409
- Encrypts the document.
410
-
411
- Args:
412
- securityPolicy : The security policy.
413
- """
414
- intPtrSec:c_void_p = securityPolicy.Ptr
415
- GetDllLibPdf().PdfDocument_set_Encrypt.argtypes=[c_void_p, c_void_p]
416
- CallCFunction(GetDllLibPdf().PdfDocument_set_Encrypt,self.Ptr, intPtrSec)
417
-
418
- @dispatch
419
- def Decrypt(self ,ownerPassword:str):
420
- """
421
- Decrypts the document.
422
-
423
- Args:
424
- ownerPassword : The ownerPassword.
425
- """
426
- GetDllLibPdf().PdfDocument_set_DecryptO.argtypes=[c_void_p, c_wchar_p]
427
- CallCFunction(GetDllLibPdf().PdfDocument_set_DecryptO,self.Ptr, ownerPassword)
428
-
429
- @dispatch
430
- def Decrypt(self):
431
- """
432
- Decrypts the document.
433
- """
434
- GetDllLibPdf().PdfDocument_set_Decrypt.argtypes=[c_void_p]
435
- CallCFunction(GetDllLibPdf().PdfDocument_set_Decrypt,self.Ptr)
436
-
437
- @dispatch
438
-
439
- def AppendPage(self ,PdfDocument):
440
- """
441
- Appends the specified loaded document to this one.
442
-
443
- Args:
444
- PdfDocument (PdfDocument): The loaded document..
445
- """
446
- intPtrdoc:c_void_p = PdfDocument.Ptr
447
-
448
- GetDllLibPdf().PdfDocument_AppendPage.argtypes=[c_void_p ,c_void_p]
449
- CallCFunction(GetDllLibPdf().PdfDocument_AppendPage,self.Ptr, intPtrdoc)
450
-
451
- @dispatch
452
-
453
- def AppendPage(self)->PdfPageBase:
454
- """
455
- Appends a new page to this one.
456
-
457
- Returns:
458
- PdfPageBase: The new page.
459
- """
460
- GetDllLibPdf().PdfDocument_AppendPage1.argtypes=[c_void_p]
461
- GetDllLibPdf().PdfDocument_AppendPage1.restype=c_void_p
462
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_AppendPage1,self.Ptr)
463
- ret = None if intPtr==None else PdfPageBase(intPtr)
464
- return ret
465
-
466
-
467
- @dispatch
468
-
469
- def InsertPage(self ,PdfDocument,page:PdfPageBase)->PdfPageBase:
470
- """
471
- Imports a page.
472
-
473
- Args:
474
- ldDoc (PdfDocument): The loaded document.
475
- page (PdfPageBase): The page.
476
-
477
- Returns:
478
- PdfPageBase: The page in the result document.
479
- """
480
- intPtrldDoc:c_void_p = PdfDocument.Ptr
481
- intPtrpage:c_void_p = page.Ptr
482
-
483
- GetDllLibPdf().PdfDocument_InsertPage.argtypes=[c_void_p ,c_void_p,c_void_p]
484
- GetDllLibPdf().PdfDocument_InsertPage.restype=c_void_p
485
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_InsertPage,self.Ptr, intPtrldDoc,intPtrpage)
486
- ret = None if intPtr==None else PdfPageBase(intPtr)
487
- return ret
488
-
489
-
490
- @dispatch
491
-
492
- def InsertPage(self ,PdfDocument,pageIndex:int)->PdfPageBase:
493
- """
494
- Imports a page.
495
-
496
- Args:
497
- ldDoc (PdfDocument): The loaded document.
498
- pageIndex (int): Index of the page.
499
-
500
- Returns:
501
- PdfPageBase: The page in the result document.
502
- """
503
- intPtrldDoc:c_void_p = PdfDocument.Ptr
504
-
505
- GetDllLibPdf().PdfDocument_InsertPageLP.argtypes=[c_void_p ,c_void_p,c_int]
506
- GetDllLibPdf().PdfDocument_InsertPageLP.restype=c_void_p
507
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_InsertPageLP,self.Ptr, intPtrldDoc,pageIndex)
508
- ret = None if intPtr==None else PdfPageBase(intPtr)
509
- return ret
510
-
511
-
512
- @dispatch
513
-
514
- def InsertPage(self ,PdfDocument,pageIndex:int,resultPageIndex:int)->PdfPageBase:
515
- """
516
- Imports a page.
517
-
518
- Args:
519
- ldDoc (PdfDocument): The loaded document.
520
- pageIndex (int): Index of the page.
521
- resultPageIndex (int): The page index in the result document.
522
-
523
- Returns:
524
- PdfPageBase: The page in the result document.
525
- """
526
- intPtrldDoc:c_void_p = PdfDocument.Ptr
527
-
528
- GetDllLibPdf().PdfDocument_InsertPageLPR.argtypes=[c_void_p ,c_void_p,c_int,c_int]
529
- GetDllLibPdf().PdfDocument_InsertPageLPR.restype=c_void_p
530
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_InsertPageLPR,self.Ptr, intPtrldDoc,pageIndex,resultPageIndex)
531
- ret = None if intPtr==None else PdfPageBase(intPtr)
532
- return ret
533
-
534
-
535
-
536
- def InsertPageRange(self ,PdfDocument,startIndex:int,endIndex:int)->PdfPageBase:
537
- """
538
- Imports a page range from a loaded document.
539
-
540
- Args:
541
- ldDoc (PdfDocument): The loaded document.
542
- startIndex (int): The start page index.
543
- endIndex (int): The end page index.
544
-
545
- Returns:
546
- PdfPageBase: The last created page in the result document.
547
- """
548
- intPtrldDoc:c_void_p = PdfDocument.Ptr
549
-
550
- GetDllLibPdf().PdfDocument_InsertPageRange.argtypes=[c_void_p ,c_void_p,c_int,c_int]
551
- GetDllLibPdf().PdfDocument_InsertPageRange.restype=c_void_p
552
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_InsertPageRange,self.Ptr, intPtrldDoc,startIndex,endIndex)
553
- ret = None if intPtr==None else PdfPageBase(intPtr)
554
- return ret
555
-
556
-
557
- @staticmethod
558
-
559
- def Merge(dest:PdfDocumentBase,sourceDocuments:List['SpireObject'])->PdfDocumentBase:
560
- """
561
- Merges the specified source documents and return destination document.
562
- ***It is recommended to use method "MergeFiles(string[] inputFiles, string outputFile)" or "MergeFiles(stream[] inputFiles, stream[] outputFile)",
563
- which automatically release srcFiles and mergeFils resources after merging.***
564
-
565
- Args:
566
- dest (PdfDocumentBase): The destination document, where the other documents are merged into.If it's null a new document object will be created.
567
- sourceDocuments (List['SpireObject']): The source documents.
568
-
569
- Returns:
570
- PdfDocumentBase: The document containing merged documents.
571
- """
572
- intPtrdest:c_void_p = dest.Ptr
573
- #arraysourceDocuments:ArrayTypesourceDocuments = ""
574
- countsourceDocuments = len(sourceDocuments)
575
- ArrayTypesourceDocuments = c_void_p * countsourceDocuments
576
- arraysourceDocuments = ArrayTypesourceDocuments()
577
- for i in range(0, countsourceDocuments):
578
- arraysourceDocuments[i] = sourceDocuments[i].Ptr
579
-
580
-
581
- GetDllLibPdf().PdfDocument_Merge.argtypes=[ c_void_p,ArrayTypesourceDocuments]
582
- GetDllLibPdf().PdfDocument_Merge.restype=c_void_p
583
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_Merge, intPtrdest,arraysourceDocuments)
584
- ret = None if intPtr==None else PdfDocumentBase(intPtr)
585
- return ret
586
-
587
-
588
- @staticmethod
589
- @dispatch
590
-
591
- def MergeFiles(inputFiles:List[str])->PdfDocumentBase:
592
- """
593
- Merges the PDF documents specified by the paths.
594
- ***It is recommended to use method "MergeFiles(string[] inputFiles, string outputFile)" or "MergeFiles(stream[] inputFiles, stream[] outputFile)",
595
- which automatically release srcFiles and mergeFils resources after merging.***
596
-
597
- Args:
598
- inputFiles (List[str]): The array of string paths.
599
-
600
- Returns:
601
- PdfDocumentBase: A new PDF document containing all merged documents.
602
- """
603
- #arrayinputFiles:ArrayTypeinputFiles = ""
604
- countinputFiles = len(inputFiles)
605
- ArrayTypeinputFiles = c_wchar_p * countinputFiles
606
- arrayinputFiles = ArrayTypeinputFiles()
607
- for i in range(0, countinputFiles):
608
- arrayinputFiles[i] = inputFiles[i]
609
-
610
-
611
- GetDllLibPdf().PdfDocument_MergeFiles.argtypes=[c_void_p, ArrayTypeinputFiles,c_int]
612
- GetDllLibPdf().PdfDocument_MergeFiles.restype=c_void_p
613
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_MergeFiles,None, arrayinputFiles,len(inputFiles))
614
- ret = None if intPtr==None else PdfDocumentBase(intPtr)
615
- return ret
616
-
617
-
618
- @staticmethod
619
- @dispatch
620
-
621
- def MergeFiles(streams:List[Stream])->PdfDocumentBase:
622
- """
623
- Merges the PDF documents specified by the Stream.
624
- ***It is recommended to use method "MergeFiles(string[] inputFiles, string outputFile)" or "MergeFiles(stream[] inputFiles, stream[] outputFile)",
625
- which automatically release srcFiles and mergeFils resources after merging.***
626
-
627
- Args:
628
- streams (List[Stream]): The array of Stream.
629
-
630
- Returns:
631
- PdfDocumentBase: A new PDF document containing all merged documents.
632
- """
633
- #arraystreams:ArrayTypestreams = ""
634
- countstreams = len(streams)
635
- ArrayTypestreams = c_void_p * countstreams
636
- arraystreams = ArrayTypestreams()
637
- for i in range(0, countstreams):
638
- arraystreams[i] = streams[i].Ptr
639
-
640
-
641
- GetDllLibPdf().PdfDocument_MergeFilesS.argtypes=[c_void_p, ArrayTypestreams,c_int]
642
- GetDllLibPdf().PdfDocument_MergeFilesS.restype=c_void_p
643
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_MergeFilesS,None, arraystreams,countstreams)
644
- ret = None if intPtr==None else PdfDocumentBase(intPtr)
645
- return ret
646
- #
647
-
648
-
649
- #@staticmethod
650
- #@dispatch
651
-
652
- #def MergeFiles(firstInputFile:str,secInputFile:str)->PdfDocumentBase:
653
- # """
654
- #<summary>
655
- # Merges the PDF documents specified by the paths.
656
- #</summary>
657
- #<param name="firstInputFile"></param>
658
- #<param name="secInputFile"></param>
659
- #<returns>A new PDF document containing all merged documents.</returns>
660
- # """
661
-
662
- # GetDllLibPdf().PdfDocument_MergeFilesFS.argtypes=[ c_wchar_p,c_wchar_p]
663
- # GetDllLibPdf().PdfDocument_MergeFilesFS.restype=c_void_p
664
- # intPtr = CallCFunction(GetDllLibPdf().PdfDocument_MergeFilesFS, firstInputFile,secInputFile)
665
- # ret = None if intPtr==None else PdfDocumentBase(intPtr)
666
- # return ret
667
-
668
-
669
- @staticmethod
670
- @dispatch
671
-
672
- def MergeFiles(inputFiles:List[str],outputFile:str):
673
- """
674
- Merge the PDF documents.
675
-
676
- Args:
677
- inputFiles (List[str]): The input PDF documents.
678
- outputFile (str): The output PDF documents.
679
- """
680
- #arrayinputFiles:ArrayTypeinputFiles = ""
681
- countinputFiles = len(inputFiles)
682
- ArrayTypeinputFiles = c_wchar_p * countinputFiles
683
- arrayinputFiles = ArrayTypeinputFiles()
684
- for i in range(0, countinputFiles):
685
- arrayinputFiles[i] = inputFiles[i]
686
-
687
-
688
- GetDllLibPdf().PdfDocument_MergeFilesIO.argtypes=[ ArrayTypeinputFiles,c_int,c_wchar_p]
689
- CallCFunction(GetDllLibPdf().PdfDocument_MergeFilesIO, arrayinputFiles,countinputFiles,outputFile)
690
-
691
- # @staticmethod
692
- # @dispatch
693
- #
694
- # def MergeFiles(inputFiles:'Stream[]',outputFile:Stream):
695
- # """
696
- # <summary>
697
- # Merge the PDF documents.
698
- # </summary>
699
- # <param name="inputFiles">The input PDF documents.</param>
700
- # <param name="outputFile">The output PDF document.</param>
701
- # """
702
- # #arrayinputFiles:ArrayTypeinputFiles = ""
703
- # countinputFiles = len(inputFiles)
704
- # ArrayTypeinputFiles = c_void_p * countinputFiles
705
- # arrayinputFiles = ArrayTypeinputFiles()
706
- # for i in range(0, countinputFiles):
707
- # arrayinputFiles[i] = inputFiles[i].Ptr
708
- #
709
- # intPtroutputFile:c_void_p = outputFile.Ptr
710
- #
711
- # GetDllLibPdf().PdfDocument_MergeFilesIO1.argtypes=[ ArrayTypeinputFiles,c_void_p]
712
- # CallCFunction(GetDllLibPdf().PdfDocument_MergeFilesIO1, arrayinputFiles,intPtroutputFile)
713
-
714
-
715
- @dispatch
716
-
717
- def Split(self ,destFilePattern:str):
718
- """
719
- Splits a PDF file to many PDF files, each of them consists of one page from the source file.
720
- Each destination file will have 'destFileName{0***}' name,
721
- where *** is an optional format string for the number of the
722
- page inside of the source document.
723
-
724
- Args:
725
- destFilePattern (str): Template for destination file names.
726
- """
727
-
728
- GetDllLibPdf().PdfDocument_Split.argtypes=[c_void_p ,c_wchar_p]
729
- CallCFunction(GetDllLibPdf().PdfDocument_Split,self.Ptr, destFilePattern)
730
-
731
- @dispatch
732
-
733
- def Split(self ,destFilePattern:str,startNumber:int):
734
- """
735
- Splits a PDF file to many PDF files, each of them consists of
736
- one page from the source file.
737
-
738
- Args:
739
- destFilePattern (str): Template for destination file names.
740
- startNumber (int): The number that is use as a start point for the page numbering.
741
- """
742
- GetDllLibPdf().PdfDocument_SplitDS.argtypes=[c_void_p ,c_wchar_p,c_int]
743
- CallCFunction(GetDllLibPdf().PdfDocument_SplitDS,self.Ptr, destFilePattern,startNumber)
744
-
745
- def RemoveDocumentJavaScript(self)->bool:
746
- """
747
- remove document's javaScript
748
-
749
- Returns:
750
- bool: if True remove succesfully,else remove the failure or document doesn't have JavaScript
751
- """
752
- GetDllLibPdf().PdfDocument_RemoveDocumentJavaScript.argtypes=[c_void_p]
753
- GetDllLibPdf().PdfDocument_RemoveDocumentJavaScript.restype=c_bool
754
- ret = CallCFunction(GetDllLibPdf().PdfDocument_RemoveDocumentJavaScript,self.Ptr)
755
- return ret
756
-
757
- #
758
- # def Preview(self ,printPreviewControl:'PrintPreviewControl'):
759
- # """
760
- # <summary>
761
- # Print preview.
762
- # </summary>
763
- # <param name="printPreviewControl">Print preview control</param>
764
- # """
765
- # intPtrprintPreviewControl:c_void_p = printPreviewControl.Ptr
766
- #
767
- # GetDllLibPdf().PdfDocument_Preview.argtypes=[c_void_p ,c_void_p]
768
- # CallCFunction(GetDllLibPdf().PdfDocument_Preview,self.Ptr, intPtrprintPreviewControl)
769
-
770
-
771
- #@dispatch
772
-
773
- #def Print(self ,printSettings:'PdfPrintSettings'):
774
- # """
775
- #<summary>
776
- # Print document.
777
- #</summary>
778
- #<param name="printSettings">The print settings.</param>
779
- # """
780
- # intPtrprintSettings:c_void_p = printSettings.Ptr
781
-
782
- # GetDllLibPdf().PdfDocument_Print.argtypes=[c_void_p ,c_void_p]
783
- # CallCFunction(GetDllLibPdf().PdfDocument_Print,self.Ptr, intPtrprintSettings)
784
-
785
- #@property
786
-
787
- #def PrintSettings(self)->'PdfPrintSettings':
788
- # """
789
- #<summary>
790
- # Get the print settings.
791
- #</summary>
792
- # """
793
- # GetDllLibPdf().PdfDocument_get_PrintSettings.argtypes=[c_void_p]
794
- # GetDllLibPdf().PdfDocument_get_PrintSettings.restype=c_void_p
795
- # intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_PrintSettings,self.Ptr)
796
- # ret = None if intPtr==None else PdfPrintSettings(intPtr)
797
- # return ret
798
-
799
-
800
- #@dispatch
801
- #def Print(self):
802
- # """
803
- #<summary>
804
- # Print document.
805
- #</summary>
806
- # """
807
- # GetDllLibPdf().PdfDocument_Print1.argtypes=[c_void_p]
808
- # CallCFunction(GetDllLibPdf().PdfDocument_Print1,self.Ptr)
809
-
810
- def Close(self):
811
- """
812
- Closes the document.
813
- The document is disposed after calling the Close method. So, the document can not be saved if Close method was invoked.
814
- """
815
- GetDllLibPdf().PdfDocument_Close.argtypes=[c_void_p]
816
- CallCFunction(GetDllLibPdf().PdfDocument_Close,self.Ptr)
817
-
818
- def Dispose(self):
819
- """
820
- Releases unmanaged resources and performs other cleanup operations before the
821
- is reclaimed by garbage collection.
822
- """
823
- GetDllLibPdf().PdfDocument_Dispose.argtypes=[c_void_p]
824
- CallCFunction(GetDllLibPdf().PdfDocument_Dispose,self.Ptr)
825
-
826
- @staticmethod
827
-
828
- def SetCustomFontsFolders(fontPath:str):
829
- """
830
- Set the path to the folder where the custom font is located.
831
-
832
- Args:
833
- fontPath (str): the folder path.
834
- """
835
- GetDllLibPdf().PdfDocument_SetCustomFontsFolders.argtypes=[ c_wchar_p]
836
- CallCFunction(GetDllLibPdf().PdfDocument_SetCustomFontsFolders, fontPath)
837
-
838
- @staticmethod
839
- def ClearCustomFontsFolders():
840
- """
841
- Clear the path of the folder where the custom font is located.
842
- """
843
- #GetDllLibPdf().PdfDocument_ClearCustomFontsFolders.argtypes=[]
844
- CallCFunction(GetDllLibPdf().PdfDocument_ClearCustomFontsFolders)
845
-
846
- @property
847
- def UseHighQualityImage(self)->bool:
848
- """
849
- Indicates whether to use the high qulity image when convert document
850
- """
851
- GetDllLibPdf().PdfDocument_get_UseHighQualityImage.argtypes=[c_void_p]
852
- GetDllLibPdf().PdfDocument_get_UseHighQualityImage.restype=c_bool
853
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_UseHighQualityImage,self.Ptr)
854
- return ret
855
-
856
- @UseHighQualityImage.setter
857
- def UseHighQualityImage(self, value:bool):
858
- GetDllLibPdf().PdfDocument_set_UseHighQualityImage.argtypes=[c_void_p, c_bool]
859
- CallCFunction(GetDllLibPdf().PdfDocument_set_UseHighQualityImage,self.Ptr, value)
860
-
861
- @property
862
-
863
- def SetPdfToHtmlParameter(self)->'PdfToHtmlParameter':
864
- """
865
-
866
- """
867
- GetDllLibPdf().PdfDocument_get_SetPdfToHtmlParameter.argtypes=[c_void_p]
868
- GetDllLibPdf().PdfDocument_get_SetPdfToHtmlParameter.restype=c_void_p
869
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_SetPdfToHtmlParameter,self.Ptr)
870
- ret = None if intPtr==None else PdfToHtmlParameter(intPtr)
871
- return ret
872
-
873
-
874
- @SetPdfToHtmlParameter.setter
875
- def SetPdfToHtmlParameter(self, value:'PdfToHtmlParameter'):
876
- GetDllLibPdf().PdfDocument_set_SetPdfToHtmlParameter.argtypes=[c_void_p, c_void_p]
877
- CallCFunction(GetDllLibPdf().PdfDocument_set_SetPdfToHtmlParameter,self.Ptr, value.Ptr)
878
-
879
- @property
880
- def AllowCreateForm(self)->bool:
881
- """
882
- Get or Set Allow Create Form.
883
- """
884
- GetDllLibPdf().PdfDocument_get_AllowCreateForm.argtypes=[c_void_p]
885
- GetDllLibPdf().PdfDocument_get_AllowCreateForm.restype=c_bool
886
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_AllowCreateForm,self.Ptr)
887
- return ret
888
-
889
- @AllowCreateForm.setter
890
- def AllowCreateForm(self, value:bool):
891
- GetDllLibPdf().PdfDocument_set_AllowCreateForm.argtypes=[c_void_p, c_bool]
892
- CallCFunction(GetDllLibPdf().PdfDocument_set_AllowCreateForm,self.Ptr, value)
893
-
894
- @property
895
- def UsePsDirectlyForConvert(self)->bool:
896
- """
897
-
898
- """
899
- GetDllLibPdf().PdfDocument_get_UsePsDirectlyForConvert.argtypes=[c_void_p]
900
- GetDllLibPdf().PdfDocument_get_UsePsDirectlyForConvert.restype=c_bool
901
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_UsePsDirectlyForConvert,self.Ptr)
902
- return ret
903
-
904
- @UsePsDirectlyForConvert.setter
905
- def UsePsDirectlyForConvert(self, value:bool):
906
- GetDllLibPdf().PdfDocument_set_UsePsDirectlyForConvert.argtypes=[c_void_p, c_bool]
907
- CallCFunction(GetDllLibPdf().PdfDocument_set_UsePsDirectlyForConvert,self.Ptr, value)
908
-
909
- @property
910
- def UseInvariantCulture(self)->bool:
911
- """
912
- Indicates whether use invariant culture mode to convert pdf document.
913
- """
914
- GetDllLibPdf().PdfDocument_get_UseInvariantCulture.argtypes=[c_void_p]
915
- GetDllLibPdf().PdfDocument_get_UseInvariantCulture.restype=c_bool
916
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_UseInvariantCulture,self.Ptr)
917
- return ret
918
-
919
- @UseInvariantCulture.setter
920
- def UseInvariantCulture(self, value:bool):
921
- GetDllLibPdf().PdfDocument_set_UseInvariantCulture.argtypes=[c_void_p, c_bool]
922
- CallCFunction(GetDllLibPdf().PdfDocument_set_UseInvariantCulture,self.Ptr, value)
923
-
924
- @property
925
-
926
- def ConvertOptions(self)->'PdfConvertOptions':
927
- """
928
- Set some options when do convert operation.
929
- """
930
- GetDllLibPdf().PdfDocument_get_ConvertOptions.argtypes=[c_void_p]
931
- GetDllLibPdf().PdfDocument_get_ConvertOptions.restype=c_void_p
932
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_ConvertOptions,self.Ptr)
933
- ret = None if intPtr==None else PdfConvertOptions(intPtr)
934
- return ret
935
-
936
-
937
- @property
938
-
939
- def PDFStandard(self)->'PdfDocumentBase':
940
- """
941
- Set,Get Current active pdf object
942
- """
943
- GetDllLibPdf().PdfDocument_get_PDFStandard.argtypes=[c_void_p]
944
- GetDllLibPdf().PdfDocument_get_PDFStandard.restype=c_void_p
945
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_PDFStandard,self.Ptr)
946
- ret = None if intPtr==None else PdfDocumentBase(intPtr)
947
- return ret
948
-
949
-
950
- @PDFStandard.setter
951
- def PDFStandard(self, value:'PdfDocumentBase'):
952
- GetDllLibPdf().PdfDocument_set_PDFStandard.argtypes=[c_void_p, c_void_p]
953
- CallCFunction(GetDllLibPdf().PdfDocument_set_PDFStandard,self.Ptr, value.Ptr)
954
-
955
- @property
956
-
957
- def Conformance(self)->'PdfConformanceLevel':
958
- """
959
- Get document PdfConformanceLevel
960
- """
961
- GetDllLibPdf().PdfDocument_get_Conformance.argtypes=[c_void_p]
962
- GetDllLibPdf().PdfDocument_get_Conformance.restype=c_int
963
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_Conformance,self.Ptr)
964
- objwraped = PdfConformanceLevel(ret)
965
- return objwraped
966
-
967
- @property
968
-
969
- def Attachments(self)->PdfAttachmentCollection:
970
- """
971
- Gets the collection of document attachments displayed on a PDF page.
972
- """
973
- GetDllLibPdf().PdfDocument_get_Attachments.argtypes=[c_void_p]
974
- GetDllLibPdf().PdfDocument_get_Attachments.restype=c_void_p
975
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Attachments,self.Ptr)
976
- ret = None if intPtr==None else PdfAttachmentCollection(intPtr)
977
- return ret
978
-
979
-
980
-
981
-
982
-
983
- @property
984
-
985
- def ColorSpace(self)->'PdfColorSpace':
986
- """
987
- Gets or sets the color space for page that will be created.
988
- """
989
- GetDllLibPdf().PdfDocument_get_ColorSpace.argtypes=[c_void_p]
990
- GetDllLibPdf().PdfDocument_get_ColorSpace.restype=c_int
991
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_ColorSpace,self.Ptr)
992
- objwraped = PdfColorSpace(ret)
993
- return objwraped
994
-
995
- @ColorSpace.setter
996
- def ColorSpace(self, value:'PdfColorSpace'):
997
- GetDllLibPdf().PdfDocument_set_ColorSpace.argtypes=[c_void_p, c_int]
998
- CallCFunction(GetDllLibPdf().PdfDocument_set_ColorSpace,self.Ptr, value.value)
999
-
1000
- @property
1001
-
1002
- def DocumentInformation(self)->'PdfDocumentInformation':
1003
- """
1004
- Gets or sets document's information and properties.
1005
- """
1006
- GetDllLibPdf().PdfDocument_get_DocumentInformation.argtypes=[c_void_p]
1007
- GetDllLibPdf().PdfDocument_get_DocumentInformation.restype=c_void_p
1008
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_DocumentInformation,self.Ptr)
1009
- ret = None if intPtr==None else PdfDocumentInformation(intPtr)
1010
- return ret
1011
-
1012
-
1013
- @property
1014
-
1015
- def JavaScripts(self)->'PdfDocumentActions':
1016
- """
1017
- Gets the additional document's actions.
1018
- """
1019
- GetDllLibPdf().PdfDocument_get_JavaScripts.argtypes=[c_void_p]
1020
- GetDllLibPdf().PdfDocument_get_JavaScripts.restype=c_void_p
1021
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_JavaScripts,self.Ptr)
1022
- ret = None if intPtr==None else PdfDocumentActions(intPtr)
1023
- return ret
1024
-
1025
-
1026
- @property
1027
-
1028
- def Form(self)->'PdfForm':
1029
- """
1030
- Gets the loaded form.
1031
- """
1032
- GetDllLibPdf().PdfDocument_get_Form.argtypes=[c_void_p]
1033
- GetDllLibPdf().PdfDocument_get_Form.restype=c_void_p
1034
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Form,self.Ptr)
1035
- ret = None if intPtr==None else PdfForm(intPtr)
1036
- return ret
1037
-
1038
-
1039
- @property
1040
-
1041
- def PageLabels(self)->'PdfPageLabels':
1042
- """
1043
- Page labels.
1044
- """
1045
- GetDllLibPdf().PdfDocument_get_PageLabels.argtypes=[c_void_p]
1046
- GetDllLibPdf().PdfDocument_get_PageLabels.restype=c_void_p
1047
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_PageLabels,self.Ptr)
1048
- ret = None if intPtr==None else PdfPageLabels(intPtr)
1049
- return ret
1050
-
1051
-
1052
- @PageLabels.setter
1053
- def PageLabels(self, value:'PdfPageLabels'):
1054
- GetDllLibPdf().PdfDocument_set_PageLabels.argtypes=[c_void_p, c_void_p]
1055
- CallCFunction(GetDllLibPdf().PdfDocument_set_PageLabels,self.Ptr, value.Ptr)
1056
-
1057
- @property
1058
-
1059
- def DocumentPieceInfo(self)->'PdfPieceInfo':
1060
- """
1061
- Gets or set the document piece info.
1062
- """
1063
- GetDllLibPdf().PdfDocument_get_DocumentPieceInfo.argtypes=[c_void_p]
1064
- GetDllLibPdf().PdfDocument_get_DocumentPieceInfo.restype=c_void_p
1065
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_DocumentPieceInfo,self.Ptr)
1066
- ret = None if intPtr==None else PdfPieceInfo(intPtr)
1067
- return ret
1068
-
1069
-
1070
- @DocumentPieceInfo.setter
1071
- def DocumentPieceInfo(self, value:'PdfPieceInfo'):
1072
- GetDllLibPdf().PdfDocument_set_DocumentPieceInfo.argtypes=[c_void_p, c_void_p]
1073
- CallCFunction(GetDllLibPdf().PdfDocument_set_DocumentPieceInfo,self.Ptr, value.Ptr)
1074
-
1075
- @property
1076
-
1077
- def Pages(self)->PdfPageCollection:
1078
- """
1079
- Gets the pages.
1080
- """
1081
- GetDllLibPdf().PdfDocument_get_Pages.argtypes=[c_void_p]
1082
- GetDllLibPdf().PdfDocument_get_Pages.restype=c_void_p
1083
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Pages,self.Ptr)
1084
- ret = None if intPtr==None else PdfPageCollection(intPtr)
1085
- return ret
1086
-
1087
-
1088
- @property
1089
-
1090
- def UsedFonts(self)->List['PdfUsedFont']:
1091
- """
1092
- Gets the fonts which are available in the PDF document.
1093
-
1094
- Returns:
1095
- List[PdfUsedFont]: Retruns the fonts which are used in the PDF document.
1096
- """
1097
- GetDllLibPdf().PdfDocument_get_UsedFonts.argtypes=[c_void_p]
1098
- GetDllLibPdf().PdfDocument_get_UsedFonts.restype=IntPtrArray
1099
- intPtrArray = CallCFunction(GetDllLibPdf().PdfDocument_get_UsedFonts,self.Ptr)
1100
- ret = GetObjVectorFromArray(intPtrArray, PdfUsedFont)
1101
- return ret
1102
-
1103
-
1104
- @property
1105
-
1106
- def CompressionLevel(self)->'PdfCompressionLevel':
1107
- """
1108
- Gets or sets the desired level of stream compression.
1109
- All new objects should be compressed with this level of the compression.
1110
- """
1111
- GetDllLibPdf().PdfDocument_get_CompressionLevel.argtypes=[c_void_p]
1112
- GetDllLibPdf().PdfDocument_get_CompressionLevel.restype=c_int
1113
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_CompressionLevel,self.Ptr)
1114
- objwraped = PdfCompressionLevel(ret)
1115
- return objwraped
1116
-
1117
- @CompressionLevel.setter
1118
- def CompressionLevel(self, value:'PdfCompressionLevel'):
1119
- GetDllLibPdf().PdfDocument_set_CompressionLevel.argtypes=[c_void_p, c_int]
1120
- CallCFunction(GetDllLibPdf().PdfDocument_set_CompressionLevel,self.Ptr, value.value)
1121
-
1122
- @property
1123
-
1124
- def PageSettings(self)->'PdfPageSettings':
1125
- """
1126
-
1127
- """
1128
- GetDllLibPdf().PdfDocument_get_PageSettings.argtypes=[c_void_p]
1129
- GetDllLibPdf().PdfDocument_get_PageSettings.restype=c_void_p
1130
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_PageSettings,self.Ptr)
1131
- ret = None if intPtr==None else PdfPageSettings(intPtr)
1132
- return ret
1133
-
1134
-
1135
- @PageSettings.setter
1136
- def PageSettings(self, value:'PdfPageSettings'):
1137
- GetDllLibPdf().PdfDocument_set_PageSettings.argtypes=[c_void_p, c_void_p]
1138
- CallCFunction(GetDllLibPdf().PdfDocument_set_PageSettings,self.Ptr, value.Ptr)
1139
-
1140
- @property
1141
-
1142
- def Sections(self)->'PdfSectionCollection':
1143
- """
1144
-
1145
- """
1146
- GetDllLibPdf().PdfDocument_get_Sections.argtypes=[c_void_p]
1147
- GetDllLibPdf().PdfDocument_get_Sections.restype=c_void_p
1148
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Sections,self.Ptr)
1149
- ret = None if intPtr==None else PdfSectionCollection(intPtr)
1150
- return ret
1151
-
1152
-
1153
- @property
1154
-
1155
- def FileInfo(self)->'PdfFileInfo':
1156
- """
1157
-
1158
- """
1159
- GetDllLibPdf().PdfDocument_get_FileInfo.argtypes=[c_void_p]
1160
- GetDllLibPdf().PdfDocument_get_FileInfo.restype=c_void_p
1161
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_FileInfo,self.Ptr)
1162
- ret = None if intPtr==None else PdfFileInfo(intPtr)
1163
- return ret
1164
-
1165
-
1166
- @FileInfo.setter
1167
- def FileInfo(self, value:'PdfFileInfo'):
1168
- GetDllLibPdf().PdfDocument_set_FileInfo.argtypes=[c_void_p, c_void_p]
1169
- CallCFunction(GetDllLibPdf().PdfDocument_set_FileInfo,self.Ptr, value.Ptr)
1170
-
1171
- @property
1172
-
1173
- def Security(self)->'PdfSecurity':
1174
- """
1175
- Gets the security parameters of the document.
1176
- """
1177
- GetDllLibPdf().PdfDocument_get_Security.argtypes=[c_void_p]
1178
- GetDllLibPdf().PdfDocument_get_Security.restype=c_void_p
1179
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Security,self.Ptr)
1180
- ret = None if intPtr==None else PdfSecurity(intPtr)
1181
- return ret
1182
-
1183
-
1184
- @property
1185
-
1186
- def ViewerPreferences(self)->'PdfViewerPreferences':
1187
- """
1188
- Gets or sets a viewer preferences object controlling the way the document is to be
1189
- presented on the screen or in print.
1190
- """
1191
- GetDllLibPdf().PdfDocument_get_ViewerPreferences.argtypes=[c_void_p]
1192
- GetDllLibPdf().PdfDocument_get_ViewerPreferences.restype=c_void_p
1193
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_ViewerPreferences,self.Ptr)
1194
- ret = None if intPtr==None else PdfViewerPreferences(intPtr)
1195
- return ret
1196
-
1197
-
1198
- @ViewerPreferences.setter
1199
- def ViewerPreferences(self, value:'PdfViewerPreferences'):
1200
- GetDllLibPdf().PdfDocument_set_ViewerPreferences.argtypes=[c_void_p, c_void_p]
1201
- CallCFunction(GetDllLibPdf().PdfDocument_set_ViewerPreferences,self.Ptr, value.Ptr)
1202
-
1203
- @property
1204
-
1205
- def AfterOpenAction(self)->'PdfGoToAction':
1206
- """
1207
- Gets or sets the action to execute when the document is opened.
1208
- """
1209
- GetDllLibPdf().PdfDocument_get_AfterOpenAction.argtypes=[c_void_p]
1210
- GetDllLibPdf().PdfDocument_get_AfterOpenAction.restype=c_void_p
1211
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_AfterOpenAction,self.Ptr)
1212
- ret = None if intPtr==None else PdfGoToAction(PdfDestination(intPtr))
1213
- return ret
1214
-
1215
-
1216
- @AfterOpenAction.setter
1217
- def AfterOpenAction(self, value:PdfAction):
1218
- if value is None :
1219
- GetDllLibPdf().PdfDocument_set_AfterOpenActionN.argtypes=[c_void_p]
1220
- CallCFunction(GetDllLibPdf().PdfDocument_set_AfterOpenActionN,self.Ptr)
1221
- else :
1222
- GetDllLibPdf().PdfDocument_set_AfterOpenAction.argtypes=[c_void_p, c_void_p]
1223
- CallCFunction(GetDllLibPdf().PdfDocument_set_AfterOpenAction,self.Ptr, value.Ptr)
1224
-
1225
- @property
1226
-
1227
- def AfterPrintAction(self)->'PdfJavaScriptAction':
1228
- """
1229
- Gets or sets the action to be performed after the document is printed.
1230
- A object specifying the action to be executed after the document is printed.
1231
- """
1232
- GetDllLibPdf().PdfDocument_get_AfterPrintAction.argtypes=[c_void_p]
1233
- GetDllLibPdf().PdfDocument_get_AfterPrintAction.restype=c_void_p
1234
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_AfterPrintAction,self.Ptr)
1235
- ret = None if intPtr==None else PdfJavaScriptAction(intPtr)
1236
- return ret
1237
-
1238
-
1239
- @AfterPrintAction.setter
1240
- def AfterPrintAction(self, value:'PdfJavaScriptAction'):
1241
- GetDllLibPdf().PdfDocument_set_AfterPrintAction.argtypes=[c_void_p, c_void_p]
1242
- CallCFunction(GetDllLibPdf().PdfDocument_set_AfterPrintAction,self.Ptr, value.Ptr)
1243
-
1244
- @property
1245
-
1246
- def AfterSaveAction(self)->'PdfJavaScriptAction':
1247
- """
1248
- Gets or sets the jave script action to be performed after the document is saved.
1249
- A object specifying the action to be executed after the document is saved.
1250
- """
1251
- GetDllLibPdf().PdfDocument_get_AfterSaveAction.argtypes=[c_void_p]
1252
- GetDllLibPdf().PdfDocument_get_AfterSaveAction.restype=c_void_p
1253
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_AfterSaveAction,self.Ptr)
1254
- ret = None if intPtr==None else PdfJavaScriptAction(intPtr)
1255
- return ret
1256
-
1257
-
1258
- @AfterSaveAction.setter
1259
- def AfterSaveAction(self, value:'PdfJavaScriptAction'):
1260
- GetDllLibPdf().PdfDocument_set_AfterSaveAction.argtypes=[c_void_p, c_void_p]
1261
- CallCFunction(GetDllLibPdf().PdfDocument_set_AfterSaveAction,self.Ptr, value.Ptr)
1262
-
1263
- @property
1264
-
1265
- def BeforeCloseAction(self)->'PdfJavaScriptAction':
1266
- """
1267
- Gets or sets the action to be performed before the document is closed.
1268
- A object specifying the action to be executed before the document is closed.
1269
- """
1270
- GetDllLibPdf().PdfDocument_get_BeforeCloseAction.argtypes=[c_void_p]
1271
- GetDllLibPdf().PdfDocument_get_BeforeCloseAction.restype=c_void_p
1272
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_BeforeCloseAction,self.Ptr)
1273
- ret = None if intPtr==None else PdfJavaScriptAction(intPtr)
1274
- return ret
1275
-
1276
-
1277
- @BeforeCloseAction.setter
1278
- def BeforeCloseAction(self, value:'PdfJavaScriptAction'):
1279
- GetDllLibPdf().PdfDocument_set_BeforeCloseAction.argtypes=[c_void_p, c_void_p]
1280
- CallCFunction(GetDllLibPdf().PdfDocument_set_BeforeCloseAction,self.Ptr, value.Ptr)
1281
-
1282
- @property
1283
-
1284
- def BeforePrintAction(self)->'PdfJavaScriptAction':
1285
- """
1286
- Gets or sets the action to be performed before the document is printed.
1287
- A object specifying the action to be executed before the document is printed.
1288
- """
1289
- GetDllLibPdf().PdfDocument_get_BeforePrintAction.argtypes=[c_void_p]
1290
- GetDllLibPdf().PdfDocument_get_BeforePrintAction.restype=c_void_p
1291
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_BeforePrintAction,self.Ptr)
1292
- ret = None if intPtr==None else PdfJavaScriptAction(intPtr)
1293
- return ret
1294
-
1295
-
1296
- @BeforePrintAction.setter
1297
- def BeforePrintAction(self, value:'PdfJavaScriptAction'):
1298
- GetDllLibPdf().PdfDocument_set_BeforePrintAction.argtypes=[c_void_p, c_void_p]
1299
- CallCFunction(GetDllLibPdf().PdfDocument_set_BeforePrintAction,self.Ptr, value.Ptr)
1300
-
1301
- @property
1302
-
1303
- def BeforeSaveAction(self)->'PdfJavaScriptAction':
1304
- """
1305
- Gets or sets the java script action to be performed before the document is saved.
1306
- A object specifying the action to be executed before the document is saved.
1307
- """
1308
- GetDllLibPdf().PdfDocument_get_BeforeSaveAction.argtypes=[c_void_p]
1309
- GetDllLibPdf().PdfDocument_get_BeforeSaveAction.restype=c_void_p
1310
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_BeforeSaveAction,self.Ptr)
1311
- ret = None if intPtr==None else PdfJavaScriptAction(intPtr)
1312
- return ret
1313
-
1314
-
1315
- @BeforeSaveAction.setter
1316
- def BeforeSaveAction(self, value:'PdfJavaScriptAction'):
1317
- GetDllLibPdf().PdfDocument_set_BeforeSaveAction.argtypes=[c_void_p, c_void_p]
1318
- CallCFunction(GetDllLibPdf().PdfDocument_set_BeforeSaveAction,self.Ptr, value.Ptr)
1319
-
1320
- @property
1321
-
1322
- def XmpMetaData(self)->'XmpMetadata':
1323
- """
1324
-
1325
- """
1326
- GetDllLibPdf().PdfDocument_get_XmpMetaData.argtypes=[c_void_p]
1327
- GetDllLibPdf().PdfDocument_get_XmpMetaData.restype=c_void_p
1328
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_XmpMetaData,self.Ptr)
1329
- ret = None if intPtr==None else XmpMetadata(intPtr)
1330
- return ret
1331
-
1332
-
1333
- @property
1334
-
1335
- def Template(self)->'PdfDocumentTemplate':
1336
- """
1337
- Gets the template of pdf document
1338
- """
1339
- GetDllLibPdf().PdfDocument_get_Template.argtypes=[c_void_p]
1340
- GetDllLibPdf().PdfDocument_get_Template.restype=c_void_p
1341
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Template,self.Ptr)
1342
- ret = None if intPtr==None else PdfDocumentTemplate(intPtr)
1343
- return ret
1344
-
1345
-
1346
- @staticmethod
1347
- def get_EnableFontCache()->bool:
1348
- """
1349
- Indicates whether enable font cache.
1350
- """
1351
- #GetDllLibPdf().PdfDocument_get_EnableFontCache.argtypes=[]
1352
- GetDllLibPdf().PdfDocument_get_EnableFontCache.restype=c_bool
1353
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_EnableFontCache)
1354
- return ret
1355
-
1356
- @staticmethod
1357
- def set_EnableFontCache( value:bool):
1358
- GetDllLibPdf().PdfDocument_set_EnableFontCache.argtypes=[ c_bool]
1359
- CallCFunction(GetDllLibPdf().PdfDocument_set_EnableFontCache, value)
1360
-
1361
- @property
1362
-
1363
- def Tag(self)->'SpireObject':
1364
- """
1365
-
1366
- """
1367
- GetDllLibPdf().PdfDocument_get_Tag.argtypes=[c_void_p]
1368
- GetDllLibPdf().PdfDocument_get_Tag.restype=c_void_p
1369
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Tag,self.Ptr)
1370
- ret = None if intPtr==None else SpireObject(intPtr)
1371
- return ret
1372
-
1373
-
1374
- @Tag.setter
1375
- def Tag(self, value:'SpireObject'):
1376
- GetDllLibPdf().PdfDocument_set_Tag.argtypes=[c_void_p, c_void_p]
1377
- CallCFunction(GetDllLibPdf().PdfDocument_set_Tag,self.Ptr, value.Ptr)
1378
-
1379
- @property
1380
- def IsEncrypted(self)->bool:
1381
- """
1382
- Indicates the document is encrypted or not.
1383
- """
1384
- GetDllLibPdf().PdfDocument_get_IsEncrypted.argtypes=[c_void_p]
1385
- GetDllLibPdf().PdfDocument_get_IsEncrypted.restype=c_bool
1386
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_IsEncrypted,self.Ptr)
1387
- return ret
1388
-
1389
- @property
1390
- def IsPortfolio(self)->bool:
1391
- """
1392
- Indicates the document is a PDF Portfolio or not.
1393
- """
1394
- GetDllLibPdf().PdfDocument_get_IsPortfolio.argtypes=[c_void_p]
1395
- GetDllLibPdf().PdfDocument_get_IsPortfolio.restype=c_bool
1396
- ret = CallCFunction(GetDllLibPdf().PdfDocument_get_IsPortfolio,self.Ptr)
1397
- return ret
1398
-
1399
- @property
1400
-
1401
- def Layers(self)->'PdfLayerCollection':
1402
- """
1403
- Optional content properties
1404
- """
1405
- GetDllLibPdf().PdfDocument_get_Layers.argtypes=[c_void_p]
1406
- GetDllLibPdf().PdfDocument_get_Layers.restype=c_void_p
1407
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Layers,self.Ptr)
1408
- ret = None if intPtr==None else PdfLayerCollection(intPtr)
1409
- return ret
1410
-
1411
-
1412
- @property
1413
-
1414
- def Collection(self)->'Collections_PdfCollection':
1415
- """
1416
- The pdf collections.
1417
- """
1418
- GetDllLibPdf().PdfDocument_get_Collection.argtypes=[c_void_p]
1419
- GetDllLibPdf().PdfDocument_get_Collection.restype=c_void_p
1420
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Collection,self.Ptr)
1421
- ret = None if intPtr==None else Collections_PdfCollection(intPtr)
1422
- return ret
1423
-
1424
-
1425
- #@dispatch
1426
- #def LoadFromFile(self ,filename:str):
1427
- # """
1428
- #Initializes a new instance of the class.
1429
- #Args:
1430
- # arg:The path to source pdf file.
1431
- # """
1432
- # GetDllLibPdf().PdfDocument_LoadFromFile.argtypes=[c_void_p ,c_wchar_p]
1433
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFile,self.Ptr, filename)
1434
-
1435
- #@dispatch
1436
- #def LoadFromFile(self ,filename:str,password:str):
1437
- # """
1438
- #<summary>
1439
- # Initializes a new instance of the class.
1440
- #</summary>
1441
- #<param name="filename">The path to source PDF document.</param>
1442
- #<param name="password">The password (user or owner) of the encrypted document.</param>
1443
- # """
1444
-
1445
- # GetDllLibPdf().PdfDocument_LoadFromFileFP.argtypes=[c_void_p ,c_wchar_p,c_wchar_p]
1446
- # GetDllLibPdf().PdfDocument_LoadFromFileFP.restype=IntPtrWithTypeName
1447
- # intPtr = CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFileFP,self.Ptr, filename,password)
1448
- # emessage = PtrToStr(intPtr.typeName)
1449
- # if emessage != None :
1450
- # print(emessage)
1451
-
1452
- #@dispatch
1453
- #def LoadFromFile(self ,fileName:str,fileFormat:FileFormat):
1454
- # """
1455
-
1456
- # """
1457
- # enumfileFormat:c_int = fileFormat.value
1458
-
1459
- # GetDllLibPdf().PdfDocument_LoadFromFileFF.argtypes=[c_void_p ,c_wchar_p,c_int]
1460
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFileFF,self.Ptr, fileName,enumfileFormat)
1461
- @overload
1462
- def LoadFromFile(self, filename: str):
1463
- """
1464
- Initializes a new instance of the class.
1465
-
1466
- Args:
1467
- filename: The to source pdf file.
1468
-
1469
- Remarks:
1470
- This constructor imports an existing pdf file into the document object. It automatically populates
1471
- the Pages collection with the pages of the given document.
1472
- """
1473
- pass
1474
-
1475
- @overload
1476
- def LoadFromFile(self, filename: str, password: str):
1477
- """
1478
- Initializes a new instance of the class.
1479
-
1480
- Args:
1481
- filename: The to source PDF document.
1482
- password: The password (user or owner) of the encrypted document.
1483
- """
1484
- pass
1485
-
1486
- @overload
1487
- def LoadFromFile(self, filename: str, fileFormat: FileFormat):
1488
- """
1489
- Initializes a new instance of the class.
1490
-
1491
- Args:
1492
- filename: The path to source PDF document.
1493
- fileFormat: The file format to be loaded.
1494
- """
1495
- pass
1496
-
1497
- def LoadFromFile(self, *args, **kwargs):
1498
- if len(args) == 2 and isinstance(args[1], str):
1499
- filename, password = args
1500
-
1501
- # Original logic for LoadFromFile(filename, password)
1502
- GetDllLibPdf().PdfDocument_LoadFromFileFP.argtypes = [c_void_p, c_wchar_p, c_wchar_p]
1503
- GetDllLibPdf().PdfDocument_LoadFromFileFP.restype = IntPtrWithTypeName
1504
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFileFP,self.Ptr, filename, password)
1505
- emessage = PtrToStr(intPtr.typeName)
1506
- if emessage is not None:
1507
- print(emessage)
1508
-
1509
- elif len(args) == 2 and isinstance(args[1], FileFormat):
1510
- filename, fileFormat = args
1511
-
1512
- # Original logic for LoadFromFile(filename, fileFormat)
1513
- enumfileFormat = fileFormat.value
1514
- GetDllLibPdf().PdfDocument_LoadFromFileFF.argtypes = [c_void_p, c_wchar_p, c_int]
1515
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFileFF,self.Ptr, filename, enumfileFormat)
1516
-
1517
- elif len(args) == 1:
1518
- filename = args[0]
1519
-
1520
- # Original logic for LoadFromFile(filename)
1521
- GetDllLibPdf().PdfDocument_LoadFromFile.argtypes = [c_void_p, c_wchar_p]
1522
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromFile,self.Ptr, filename)
1523
- # @dispatch
1524
- #
1525
- # def LoadFromXPS(self ,xpsBytes:'Byte[]'):
1526
- # """
1527
- # <summary>
1528
- # Load a xps bytes array.
1529
- # </summary>
1530
- # <param name="xpsBytes">the xps byte array</param>
1531
- # """
1532
- # #arrayxpsBytes:ArrayTypexpsBytes = ""
1533
- # countxpsBytes = len(xpsBytes)
1534
- # ArrayTypexpsBytes = c_void_p * countxpsBytes
1535
- # arrayxpsBytes = ArrayTypexpsBytes()
1536
- # for i in range(0, countxpsBytes):
1537
- # arrayxpsBytes[i] = xpsBytes[i].Ptr
1538
- #
1539
- #
1540
- # GetDllLibPdf().PdfDocument_LoadFromXPS.argtypes=[c_void_p ,ArrayTypexpsBytes]
1541
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromXPS,self.Ptr, arrayxpsBytes)
1542
-
1543
-
1544
- #@dispatch
1545
-
1546
- #def LoadFromXPS(self ,fileName:str):
1547
- # """
1548
- #<summary>
1549
- # Load a xps file.
1550
- #</summary>
1551
- #<param name="fileName"></param>
1552
- # """
1553
-
1554
- # GetDllLibPdf().PdfDocument_LoadFromXPSF.argtypes=[c_void_p ,c_wchar_p]
1555
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromXPSF,self.Ptr, fileName)
1556
-
1557
- #@dispatch
1558
-
1559
- #def LoadFromXPS(self ,xpsStream:Stream):
1560
- # """
1561
- #<summary>
1562
- # Load a xps stream.
1563
- #</summary>
1564
- #<param name="xpsStream"></param>
1565
- # """
1566
- # intPtrxpsStream:c_void_p = xpsStream.Ptr
1567
-
1568
- # GetDllLibPdf().PdfDocument_LoadFromXPSX.argtypes=[c_void_p ,c_void_p]
1569
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromXPSX,self.Ptr, intPtrxpsStream)
1570
-
1571
- @dispatch
1572
-
1573
- def LoadFromSvg(self ,fileName:str):
1574
- """
1575
- Load a svg file.
1576
-
1577
- Args:
1578
- fileName (str): A relative or absolute path for the svg file.
1579
- """
1580
- GetDllLibPdf().PdfDocument_LoadFromSvg.argtypes=[c_void_p ,c_wchar_p]
1581
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromSvg,self.Ptr, fileName)
1582
-
1583
- @dispatch
1584
-
1585
- def LoadFromSvg(self ,stream:Stream):
1586
- """
1587
- Load a svg stream.
1588
-
1589
- Args:
1590
- stream (Stream): A Svg file stream.
1591
- """
1592
- intPtrstream:c_void_p = stream.Ptr
1593
-
1594
- GetDllLibPdf().PdfDocument_LoadFromSvgS.argtypes=[c_void_p ,c_void_p]
1595
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromSvgS,self.Ptr, intPtrstream)
1596
-
1597
- #@dispatch
1598
-
1599
- #def LoadFromHTML(self ,url:str,enableJavaScript:bool,enableHyperlinks:bool,autoDetectPageBreak:bool):
1600
- # """
1601
- #<summary>
1602
- # Load file from disk file.
1603
- #</summary>
1604
- #<param name="url">url address</param>
1605
- #<param name="enableJavaScript">Enable javascrpit</param>
1606
- #<param name="enableHyperlinks">Enable hyperlink</param>
1607
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1608
- # """
1609
-
1610
- # GetDllLibPdf().PdfDocument_LoadFromHTML.argtypes=[c_void_p ,c_wchar_p,c_bool,c_bool,c_bool]
1611
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTML,self.Ptr, url,enableJavaScript,enableHyperlinks,autoDetectPageBreak)
1612
-
1613
- #@dispatch
1614
-
1615
- #def LoadFromHTML(self ,Url:str,enableJavaScript:bool,enableHyperlinks:bool,autoDetectPageBreak:bool,setting:PdfPageSettings):
1616
- # """
1617
- #<summary>
1618
- # Load file from disk file.
1619
- #</summary>
1620
- #<param name="url">url address</param>
1621
- #<param name="enableJavaScript">Enable javascrpit</param>
1622
- #<param name="enableHyperlinks">Enable hyperlink</param>
1623
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1624
- #<param name="Size">paper size</param>
1625
- #<param name="layoutFormat">PdfHtmlLayoutFormat layoutFormat</param>
1626
- # """
1627
- # intPtrsetting:c_void_p = setting.Ptr
1628
-
1629
- # GetDllLibPdf().PdfDocument_LoadFromHTMLUEEAS.argtypes=[c_void_p ,c_wchar_p,c_bool,c_bool,c_bool,c_void_p]
1630
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTMLUEEAS,self.Ptr, Url,enableJavaScript,enableHyperlinks,autoDetectPageBreak,intPtrsetting)
1631
-
1632
- #@dispatch
1633
-
1634
- #def LoadFromHTML(self ,Url:str,enableJavaScript:bool,enableHyperlinks:bool,autoDetectPageBreak:bool,setting:PdfPageSettings,layoutFormat:PdfHtmlLayoutFormat):
1635
- # """
1636
- #<summary>
1637
- # Load file from disk file.
1638
- #</summary>
1639
- #<param name="url">url address</param>
1640
- #<param name="enableJavaScript">Enable javascrpit</param>
1641
- #<param name="enableHyperlinks">Enable hyperlink</param>
1642
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1643
- #<param name="Size">paper size</param>
1644
- #<param name="layoutFormat">PdfHtmlLayoutFormat layoutFormat</param>
1645
- # """
1646
- # intPtrsetting:c_void_p = setting.Ptr
1647
- # intPtrlayoutFormat:c_void_p = layoutFormat.Ptr
1648
-
1649
- # GetDllLibPdf().PdfDocument_LoadFromHTMLUEEASL.argtypes=[c_void_p ,c_wchar_p,c_bool,c_bool,c_bool,c_void_p,c_void_p]
1650
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTMLUEEASL,self.Ptr, Url,enableJavaScript,enableHyperlinks,autoDetectPageBreak,intPtrsetting,intPtrlayoutFormat)
1651
-
1652
- #@dispatch
1653
-
1654
- #def LoadFromHTML(self ,url:str,enableJavaScript:bool,enableHyperlinks:bool,autoDetectPageBreak:bool,setting:PdfPageSettings,layoutFormat:PdfHtmlLayoutFormat,isLoadComplete:bool):
1655
- # """
1656
- #<summary>
1657
- # Load file from disk file.
1658
- #</summary>
1659
- #<param name="url">url address</param>
1660
- #<param name="enableJavaScript">Enable javascrpit</param>
1661
- #<param name="enableHyperlinks">Enable hyperlink</param>
1662
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1663
- #<param name="setting">Page setting</param>
1664
- #<param name="layoutFormat">PdfHtmlLayoutFormat layoutFormat</param>
1665
- #<param name="isLoadComplete">
1666
- # by default false, when load Html DOM timeout(PdfHtmlLayoutFormat.LoadHtmlTimeout),convert uncompleted Html DOM to pdf.
1667
- # if true,until Html DOM load completed,then convert to pdf.
1668
- #</param>
1669
- # """
1670
- # intPtrsetting:c_void_p = setting.Ptr
1671
- # intPtrlayoutFormat:c_void_p = layoutFormat.Ptr
1672
-
1673
- # GetDllLibPdf().PdfDocument_LoadFromHTMLUEEASLI.argtypes=[c_void_p ,c_wchar_p,c_bool,c_bool,c_bool,c_void_p,c_void_p,c_bool]
1674
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTMLUEEASLI,self.Ptr, url,enableJavaScript,enableHyperlinks,autoDetectPageBreak,intPtrsetting,intPtrlayoutFormat,isLoadComplete)
1675
-
1676
- #@dispatch
1677
-
1678
- #def LoadFromHTML(self ,htmlSourceCode:str,autoDetectPageBreak:bool,setting:PdfPageSettings,layoutFormat:PdfHtmlLayoutFormat):
1679
- # """
1680
- #<summary>
1681
- # Load htmlSourceCode to Pdf
1682
- #</summary>
1683
- #<param name="htmlSourceCode">htmlSourceCode</param>
1684
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1685
- #<param name="setting">PdfPageSettings setting</param>
1686
- #<param name="layoutFormat">PdfHtmlLayoutFormat layoutFormat</param>
1687
- # """
1688
- # intPtrsetting:c_void_p = setting.Ptr
1689
- # intPtrlayoutFormat:c_void_p = layoutFormat.Ptr
1690
-
1691
- # GetDllLibPdf().PdfDocument_LoadFromHTMLHASL.argtypes=[c_void_p ,c_wchar_p,c_bool,c_void_p,c_void_p]
1692
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTMLHASL,self.Ptr, htmlSourceCode,autoDetectPageBreak,intPtrsetting,intPtrlayoutFormat)
1693
-
1694
- #@dispatch
1695
-
1696
- #def LoadFromHTML(self ,htmlSourceCode:str,autoDetectPageBreak:bool,setting:PdfPageSettings,layoutFormat:PdfHtmlLayoutFormat,isLoadComplete:bool):
1697
- # """
1698
- #<summary>
1699
- # Load htmlSourceCode to Pdf
1700
- #</summary>
1701
- #<param name="htmlSourceCode">htmlSourceCode</param>
1702
- #<param name="autoDetectPageBreak">Auto detect page break</param>
1703
- #<param name="setting">PdfPageSettings setting</param>
1704
- #<param name="layoutFormat">PdfHtmlLayoutFormat layoutFormat</param>
1705
- #<param name="isLoadComplete">
1706
- # by default false, when load Html DOM timeout(PdfHtmlLayoutFormat.LoadHtmlTimeout),convert uncompleted Html DOM to pdf.
1707
- # if true,until Html DOM load completed,then convert to pdf.
1708
- #</param>
1709
- # """
1710
- # intPtrsetting:c_void_p = setting.Ptr
1711
- # intPtrlayoutFormat:c_void_p = layoutFormat.Ptr
1712
-
1713
- # GetDllLibPdf().PdfDocument_LoadFromHTMLHASLI.argtypes=[c_void_p ,c_wchar_p,c_bool,c_void_p,c_void_p,c_bool]
1714
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromHTMLHASLI,self.Ptr, htmlSourceCode,autoDetectPageBreak,intPtrsetting,intPtrlayoutFormat,isLoadComplete)
1715
-
1716
- # @dispatch
1717
- #
1718
- # def LoadFromBytes(self ,bytes:'Byte[]'):
1719
- # """
1720
- # <summary>
1721
- # Initializes a new instance of the class.
1722
- # </summary>
1723
- # <param name="bytes">The byte array with the file content.</param>
1724
- # """
1725
- # #arraybytes:ArrayTypebytes = ""
1726
- # countbytes = len(bytes)
1727
- # ArrayTypebytes = c_void_p * countbytes
1728
- # arraybytes = ArrayTypebytes()
1729
- # for i in range(0, countbytes):
1730
- # arraybytes[i] = bytes[i].Ptr
1731
- #
1732
- #
1733
- # GetDllLibPdf().PdfDocument_LoadFromBytesB.argtypes=[c_void_p ,ArrayTypebytes]
1734
- # CallCFunction(GetDllLibPdf().PdfDocument_LoadFromBytesB,self.Ptr, arraybytes)
1735
-
1736
-
1737
- @dispatch
1738
-
1739
- def LoadFromStream(self ,stream:Stream):
1740
- """
1741
- Initializes a new instance of the class.
1742
-
1743
- Args:
1744
- stream (Stream): The stream with the file.
1745
- """
1746
- intPtrstream:c_void_p = stream.Ptr
1747
-
1748
- GetDllLibPdf().PdfDocument_LoadFromStreamS.argtypes=[c_void_p ,c_void_p]
1749
- CallCFunction(GetDllLibPdf().PdfDocument_LoadFromStreamS,self.Ptr, intPtrstream)
1750
-
1751
- @property
1752
- def Bookmarks(self)->PdfBookmarkCollection:
1753
- """
1754
- Gets the bookmarks.
1755
- """
1756
- GetDllLibPdf().PdfDocument_get_Bookmarks.argtypes=[c_void_p]
1757
- GetDllLibPdf().PdfDocument_get_Bookmarks.restype=c_void_p
1758
- intPtr = CallCFunction(GetDllLibPdf().PdfDocument_get_Bookmarks,self.Ptr)
1759
- ret = None if intPtr==None else PdfBookmarkCollection(intPtr)
1760
- return ret