Skip to content

Commit bee9db4

Browse files
authored
Merge pull request #156 from aspose-words/aw_for_python_release_25.8.0
Added Api Refs for Aspose.Words for Python via .Net 25.8.0
2 parents daaf2d0 + 8728271 commit bee9db4

File tree

321 files changed

+1216
-9547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+1216
-9547
lines changed

english/python-net/aspose.words.digitalsignatures/certificateholder/_index.md

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -75,71 +75,6 @@ output_file_name = ARTIFACTS_DIR + 'DigitalSignatureUtil.DecryptionPassword.docx
7575
aw.digitalsignatures.DigitalSignatureUtil.sign(src_file_name=input_file_name, dst_file_name=output_file_name, cert_holder=certificate_holder, sign_options=sign_options)
7676
```
7777

78-
Shows how to add a signature line to a document, and then sign it using a digital certificate.
79-
80-
```python
81-
def test_sign(self):
82-
83-
signee_name = "Ron Williams"
84-
src_document_path = MY_DIR + "Document.docx"
85-
dst_document_path = ARTIFACTS_DIR + "SignDocumentCustom.sign.docx"
86-
certificate_path = MY_DIR + "morzal.pfx"
87-
certificate_password = "aw"
88-
89-
for signee_info in self._create_signees():
90-
if signee_info.name == signee_name:
91-
self._sign_document(src_document_path, dst_document_path, signee_info, certificate_path,
92-
certificate_password)
93-
break
94-
else:
95-
raise Exception("Signee does not exist.")
96-
97-
def _sign_document(self, src_document_path: str, dst_document_path: str,
98-
signee_info, certificate_path: str, certificate_password: str):
99-
"""Creates a copy of a source document signed using provided signee information and X509 certificate."""
100-
101-
document = aw.Document(src_document_path)
102-
builder = aw.DocumentBuilder(document)
103-
104-
# Configure and insert a signature line, an object in the document that will display a signature that we sign it with.
105-
signature_line_options = aw.SignatureLineOptions()
106-
signature_line_options.signer = signee_info.name
107-
signature_line_options.signer_title = signee_info.position
108-
109-
signature_line = builder.insert_signature_line(signature_line_options).signature_line
110-
signature_line.id = signee_info.person_id
111-
112-
# First, we will save an unsigned version of our document.
113-
builder.document.save(dst_document_path)
114-
115-
certificate_holder = aw.digitalsignatures.CertificateHolder.create(certificate_path, certificate_password)
116-
117-
sign_options = aw.digitalsignatures.SignOptions()
118-
sign_options.signature_line_id = signee_info.person_id
119-
sign_options.signature_line_image = signee_info.image
120-
121-
# Overwrite the unsigned document we saved above with a version signed using the certificate.
122-
aw.digitalsignatures.DigitalSignatureUtil.sign(dst_document_path, dst_document_path, certificate_holder,
123-
sign_options)
124-
125-
class Signee:
126-
127-
def __init__(self, guid: uuid.UUID, name: str, position: str, image: bytes):
128-
self.person_id = guid
129-
self.name = name
130-
self.position = position
131-
self.image = image
132-
133-
def _create_signees(self):
134-
135-
return [
136-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Ron Williams", "Chief Executive Officer",
137-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg")),
138-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Stephen Morse", "Head of Compliance",
139-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg"))
140-
]
141-
```
142-
14378
### See Also
14479

14580
* module [aspose.words.digitalsignatures](../)

english/python-net/aspose.words.digitalsignatures/certificateholder/create/_index.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -106,31 +106,6 @@ An instance of [CertificateHolder](../)
106106

107107
## Examples
108108

109-
Shows how to create CertificateHolder objects.
110-
111-
```python
112-
# Below are four ways of creating CertificateHolder objects.
113-
# 1 - Load a PKCS #12 file into a byte array and apply its password:
114-
with open(MY_DIR + 'morzal.pfx', 'rb') as file:
115-
cert_bytes = file.read()
116-
aw.digitalsignatures.CertificateHolder.create(cert_bytes, 'aw')
117-
# 2 - Load a PKCS #12 file into a byte array, and apply a secure password:
118-
password = NetworkCredential('', 'aw').secure_password
119-
aw.digitalsignatures.CertificateHolder.create(cert_bytes, password)
120-
# If the certificate has private keys corresponding to aliases,
121-
# we can use the aliases to fetch their respective keys. First, we will check for valid aliases.
122-
with open(MY_DIR + 'morzal.pfx', 'rb') as cert_stream:
123-
pkcs12_store = Pkcs12Store(cert_stream, 'aw').build()
124-
pkcs12_store.load(cert_stream, 'aw')
125-
for alias in pkcs12_store.aliases:
126-
if pkcs12_store.is_key_entry(alias) and pkcs12_store.get_key(alias).key.is_private:
127-
print('Valid alias found:', alias)
128-
# 3 - Use a valid alias:
129-
aw.digitalsignatures.CertificateHolder.create(MY_DIR + 'morzal.pfx', 'aw', 'c20be521-11ea-4976-81ed-865fbbfc9f24')
130-
# 4 - Pass "null" as the alias in order to use the first available alias that returns a private key:
131-
aw.digitalsignatures.CertificateHolder.create(MY_DIR + 'morzal.pfx', 'aw', None)
132-
```
133-
134109
Shows how to digitally sign documents.
135110

136111
```python

english/python-net/aspose.words.digitalsignatures/digitalsignatureutil/sign/_index.md

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -147,71 +147,6 @@ with system_helper.io.FileStream(MY_DIR + 'Document.docx', system_helper.io.File
147147
aw.digitalsignatures.DigitalSignatureUtil.sign(src_stream=stream_in, dst_stream=stream_out, cert_holder=certificate_holder, sign_options=sign_options)
148148
```
149149

150-
Shows how to add a signature line to a document, and then sign it using a digital certificate.
151-
152-
```python
153-
def test_sign(self):
154-
155-
signee_name = "Ron Williams"
156-
src_document_path = MY_DIR + "Document.docx"
157-
dst_document_path = ARTIFACTS_DIR + "SignDocumentCustom.sign.docx"
158-
certificate_path = MY_DIR + "morzal.pfx"
159-
certificate_password = "aw"
160-
161-
for signee_info in self._create_signees():
162-
if signee_info.name == signee_name:
163-
self._sign_document(src_document_path, dst_document_path, signee_info, certificate_path,
164-
certificate_password)
165-
break
166-
else:
167-
raise Exception("Signee does not exist.")
168-
169-
def _sign_document(self, src_document_path: str, dst_document_path: str,
170-
signee_info, certificate_path: str, certificate_password: str):
171-
"""Creates a copy of a source document signed using provided signee information and X509 certificate."""
172-
173-
document = aw.Document(src_document_path)
174-
builder = aw.DocumentBuilder(document)
175-
176-
# Configure and insert a signature line, an object in the document that will display a signature that we sign it with.
177-
signature_line_options = aw.SignatureLineOptions()
178-
signature_line_options.signer = signee_info.name
179-
signature_line_options.signer_title = signee_info.position
180-
181-
signature_line = builder.insert_signature_line(signature_line_options).signature_line
182-
signature_line.id = signee_info.person_id
183-
184-
# First, we will save an unsigned version of our document.
185-
builder.document.save(dst_document_path)
186-
187-
certificate_holder = aw.digitalsignatures.CertificateHolder.create(certificate_path, certificate_password)
188-
189-
sign_options = aw.digitalsignatures.SignOptions()
190-
sign_options.signature_line_id = signee_info.person_id
191-
sign_options.signature_line_image = signee_info.image
192-
193-
# Overwrite the unsigned document we saved above with a version signed using the certificate.
194-
aw.digitalsignatures.DigitalSignatureUtil.sign(dst_document_path, dst_document_path, certificate_holder,
195-
sign_options)
196-
197-
class Signee:
198-
199-
def __init__(self, guid: uuid.UUID, name: str, position: str, image: bytes):
200-
self.person_id = guid
201-
self.name = name
202-
self.position = position
203-
self.image = image
204-
205-
def _create_signees(self):
206-
207-
return [
208-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Ron Williams", "Chief Executive Officer",
209-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg")),
210-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Stephen Morse", "Head of Compliance",
211-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg"))
212-
]
213-
```
214-
215150
Shows how to sign documents with X.509 certificates.
216151

217152
```python

english/python-net/aspose.words.digitalsignatures/signoptions/signature_line_id/_index.md

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -33,73 +33,6 @@ When set, it associates [SignatureLine](../../../aspose.words.drawing/signaturel
3333

3434

3535

36-
### Examples
37-
38-
Shows how to add a signature line to a document, and then sign it using a digital certificate.
39-
40-
```python
41-
def test_sign(self):
42-
43-
signee_name = "Ron Williams"
44-
src_document_path = MY_DIR + "Document.docx"
45-
dst_document_path = ARTIFACTS_DIR + "SignDocumentCustom.sign.docx"
46-
certificate_path = MY_DIR + "morzal.pfx"
47-
certificate_password = "aw"
48-
49-
for signee_info in self._create_signees():
50-
if signee_info.name == signee_name:
51-
self._sign_document(src_document_path, dst_document_path, signee_info, certificate_path,
52-
certificate_password)
53-
break
54-
else:
55-
raise Exception("Signee does not exist.")
56-
57-
def _sign_document(self, src_document_path: str, dst_document_path: str,
58-
signee_info, certificate_path: str, certificate_password: str):
59-
"""Creates a copy of a source document signed using provided signee information and X509 certificate."""
60-
61-
document = aw.Document(src_document_path)
62-
builder = aw.DocumentBuilder(document)
63-
64-
# Configure and insert a signature line, an object in the document that will display a signature that we sign it with.
65-
signature_line_options = aw.SignatureLineOptions()
66-
signature_line_options.signer = signee_info.name
67-
signature_line_options.signer_title = signee_info.position
68-
69-
signature_line = builder.insert_signature_line(signature_line_options).signature_line
70-
signature_line.id = signee_info.person_id
71-
72-
# First, we will save an unsigned version of our document.
73-
builder.document.save(dst_document_path)
74-
75-
certificate_holder = aw.digitalsignatures.CertificateHolder.create(certificate_path, certificate_password)
76-
77-
sign_options = aw.digitalsignatures.SignOptions()
78-
sign_options.signature_line_id = signee_info.person_id
79-
sign_options.signature_line_image = signee_info.image
80-
81-
# Overwrite the unsigned document we saved above with a version signed using the certificate.
82-
aw.digitalsignatures.DigitalSignatureUtil.sign(dst_document_path, dst_document_path, certificate_holder,
83-
sign_options)
84-
85-
class Signee:
86-
87-
def __init__(self, guid: uuid.UUID, name: str, position: str, image: bytes):
88-
self.person_id = guid
89-
self.name = name
90-
self.position = position
91-
self.image = image
92-
93-
def _create_signees(self):
94-
95-
return [
96-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Ron Williams", "Chief Executive Officer",
97-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg")),
98-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Stephen Morse", "Head of Compliance",
99-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg"))
100-
]
101-
```
102-
10336
### See Also
10437

10538
* module [aspose.words.digitalsignatures](../../)

english/python-net/aspose.words.digitalsignatures/signoptions/signature_line_image/_index.md

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -27,73 +27,6 @@ def signature_line_image(self, value: bytes):
2727

2828
```
2929

30-
### Examples
31-
32-
Shows how to add a signature line to a document, and then sign it using a digital certificate.
33-
34-
```python
35-
def test_sign(self):
36-
37-
signee_name = "Ron Williams"
38-
src_document_path = MY_DIR + "Document.docx"
39-
dst_document_path = ARTIFACTS_DIR + "SignDocumentCustom.sign.docx"
40-
certificate_path = MY_DIR + "morzal.pfx"
41-
certificate_password = "aw"
42-
43-
for signee_info in self._create_signees():
44-
if signee_info.name == signee_name:
45-
self._sign_document(src_document_path, dst_document_path, signee_info, certificate_path,
46-
certificate_password)
47-
break
48-
else:
49-
raise Exception("Signee does not exist.")
50-
51-
def _sign_document(self, src_document_path: str, dst_document_path: str,
52-
signee_info, certificate_path: str, certificate_password: str):
53-
"""Creates a copy of a source document signed using provided signee information and X509 certificate."""
54-
55-
document = aw.Document(src_document_path)
56-
builder = aw.DocumentBuilder(document)
57-
58-
# Configure and insert a signature line, an object in the document that will display a signature that we sign it with.
59-
signature_line_options = aw.SignatureLineOptions()
60-
signature_line_options.signer = signee_info.name
61-
signature_line_options.signer_title = signee_info.position
62-
63-
signature_line = builder.insert_signature_line(signature_line_options).signature_line
64-
signature_line.id = signee_info.person_id
65-
66-
# First, we will save an unsigned version of our document.
67-
builder.document.save(dst_document_path)
68-
69-
certificate_holder = aw.digitalsignatures.CertificateHolder.create(certificate_path, certificate_password)
70-
71-
sign_options = aw.digitalsignatures.SignOptions()
72-
sign_options.signature_line_id = signee_info.person_id
73-
sign_options.signature_line_image = signee_info.image
74-
75-
# Overwrite the unsigned document we saved above with a version signed using the certificate.
76-
aw.digitalsignatures.DigitalSignatureUtil.sign(dst_document_path, dst_document_path, certificate_holder,
77-
sign_options)
78-
79-
class Signee:
80-
81-
def __init__(self, guid: uuid.UUID, name: str, position: str, image: bytes):
82-
self.person_id = guid
83-
self.name = name
84-
self.position = position
85-
self.image = image
86-
87-
def _create_signees(self):
88-
89-
return [
90-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Ron Williams", "Chief Executive Officer",
91-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg")),
92-
ExSignDocumentCustom.Signee(uuid.uuid4(), "Stephen Morse", "Head of Compliance",
93-
self.image_to_byte_array(IMAGE_DIR + "Logo.jpg"))
94-
]
95-
```
96-
9730
### See Also
9831

9932
* module [aspose.words.digitalsignatures](../../)

english/python-net/aspose.words.drawing/arrowlength/_index.md

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,62 +23,6 @@ Length of the arrow at the end of a line.
2323
| LONG | |
2424
| DEFAULT | Same as [ArrowLength.SHORT](./#SHORT). |
2525

26-
### Examples
27-
28-
Shows to create a variety of shapes.
29-
30-
```python
31-
doc = aw.Document()
32-
builder = aw.DocumentBuilder(doc)
33-
# Below are four examples of shapes that we can insert into our documents.
34-
# 1 - Dotted, horizontal, half-transparent red line
35-
# with an arrow on the left end and a diamond on the right end:
36-
arrow = aw.drawing.Shape(doc, aw.drawing.ShapeType.LINE)
37-
arrow.width = 200
38-
arrow.stroke.color = drawing.Color.red
39-
arrow.stroke.start_arrow_type = aw.drawing.ArrowType.ARROW
40-
arrow.stroke.start_arrow_length = aw.drawing.ArrowLength.LONG
41-
arrow.stroke.start_arrow_width = aw.drawing.ArrowWidth.WIDE
42-
arrow.stroke.end_arrow_type = aw.drawing.ArrowType.DIAMOND
43-
arrow.stroke.end_arrow_length = aw.drawing.ArrowLength.LONG
44-
arrow.stroke.end_arrow_width = aw.drawing.ArrowWidth.WIDE
45-
arrow.stroke.dash_style = aw.drawing.DashStyle.DASH
46-
arrow.stroke.opacity = 0.5
47-
self.assertEqual(aw.drawing.JoinStyle.MITER, arrow.stroke.join_style)
48-
builder.insert_node(arrow)
49-
# 2 - Thick black diagonal line with rounded ends:
50-
line = aw.drawing.Shape(doc, aw.drawing.ShapeType.LINE)
51-
line.top = 40
52-
line.width = 200
53-
line.height = 20
54-
line.stroke_weight = 5.0
55-
line.stroke.end_cap = aw.drawing.EndCap.ROUND
56-
builder.insert_node(line)
57-
# 3 - Arrow with a green fill:
58-
filled_in_arrow = aw.drawing.Shape(doc, aw.drawing.ShapeType.ARROW)
59-
filled_in_arrow.width = 200
60-
filled_in_arrow.height = 40
61-
filled_in_arrow.top = 100
62-
filled_in_arrow.fill.fore_color = drawing.Color.green
63-
filled_in_arrow.fill.visible = True
64-
builder.insert_node(filled_in_arrow)
65-
# 4 - Arrow with a flipped orientation filled in with the Aspose logo:
66-
filled_in_arrow_img = aw.drawing.Shape(doc, aw.drawing.ShapeType.ARROW)
67-
filled_in_arrow_img.width = 200
68-
filled_in_arrow_img.height = 40
69-
filled_in_arrow_img.top = 160
70-
filled_in_arrow_img.flip_orientation = aw.drawing.FlipOrientation.BOTH
71-
with open(IMAGE_DIR + 'Logo.jpg', 'rb') as stream:
72-
image = drawing.Image.from_stream(stream)
73-
# When we flip the orientation of our arrow, we also flip the image that the arrow contains.
74-
# Flip the image the other way to cancel this out before getting the shape to display it.
75-
image.rotate_flip(drawing.RotateFlipType.ROTATE_NONE_FLIP_XY)
76-
filled_in_arrow_img.image_data.set_image(image)
77-
filled_in_arrow_img.stroke.join_style = aw.drawing.JoinStyle.ROUND
78-
builder.insert_node(filled_in_arrow_img)
79-
doc.save(ARTIFACTS_DIR + 'Drawing.various_shapes.docx')
80-
```
81-
8226
### See Also
8327

8428
* module [aspose.words.drawing](../)

0 commit comments

Comments
 (0)