Skip to content

Commit 0441ced

Browse files
authored
Merge pull request #861 from AdobeDocs/python-4.0-release-updates
python sdk 4.0 release updates
2 parents cb4e15e + 8d77f50 commit 0441ced

File tree

20 files changed

+21
-62
lines changed

20 files changed

+21
-62
lines changed

src/pages/overview/document-generation-api/quickstarts/python/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ with open(output_file_path, "wb") as file:
199199
file.write(stream_asset.get_input_stream())
200200
```
201201

202+
![alt](shot8.png)
203+
202204
Here's the complete application (`src/documentmerge/merge_document_to_pdf.py`):
203205

204206
```python
1.11 MB
Loading
106 KB
Loading

src/pages/overview/pdf-accessibility-auto-tag-api/gettingstarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ pip hash <download_dir>/pdfservices-sdk-4.0.0.tar.gz
644644
2. Verify the hash matches the value published here.
645645

646646
```
647-
08d1c40995658e380c7e5d2fec4cebfbfc22b246582719c5451ae708a28b6a09
647+
9537bf4659d3e939b86f0d925dec2eafc1fc533d09c96674791389b09c88e8c9
648648
```
649649

650650
###### To generate tagged PDF from the sample file

src/pages/overview/pdf-accessibility-auto-tag-api/howtos/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ the SDK supports custom timeouts for the API calls. You can tailor the
2929
timeout settings for your environment and network speed. In addition to
3030
the details below, you can refer to working code samples:
3131

32-
[//]: # (TODO update python sample)
33-
3432
- [Java](https://github.com/adobe/pdfservices-java-sdk-samples/blob/master/src/main/java/com/adobe/pdfservices/operation/samples/customconfigurations/CreatePDFWithCustomTimeouts.java)
3533
- [.NET](https://github.com/adobe/PDFServices.NET.SDK.Samples/blob/master/CreatePDFWithCustomTimeouts/Program.cs)
3634
- [Node.js](https://github.com/adobe/pdfservices-node-sdk-samples/blob/master/src/customconfigurations/create-pdf-with-custom-timeouts.js)
37-
- [Python](https://github.com/adobe/pdfservices-python-sdk-samples/blob/master/src/extractpdf/extract_txt_from_pdf_with_custom_timeouts.py)
35+
- [Python](https://github.com/adobe/pdfservices-python-sdk-samples/blob/main/src/customconfigurations/create_pdf_with_custom_timeouts.py)
3836

3937
### Java timeout configuration
4038

src/pages/overview/pdf-accessibility-auto-tag-api/quickstarts/python/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ To complete this guide, you will need:
4545

4646
3) At the command line, change to the directory you created, and run the following command to install the Python SDK: `pip install pdfservices-sdk`.
4747

48-
[//]: # (TODO update ss)
4948
![alt](shot7.png)
5049

5150
At this point, we've installed the Python SDK for Adobe PDF Services API as a dependency for our project and have copied over our credentials files.
@@ -136,6 +135,7 @@ with open(output_file_path, "wb") as file:
136135
file.write(stream_asset.get_input_stream())
137136
```
138137

138+
![alt](shot8.png)
139139

140140
Here's the complete application (`autotag.py`):
141141

1.11 MB
Loading
104 KB
Loading

src/pages/overview/pdf-electronic-seal-api/gettingstarted.md

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,8 @@ pip hash <download_dir>/pdfservices-sdk-4.0.0.tar.gz
692692
2. Above command will return the hash of downloaded package.
693693
3. Verify the hash matches the value published here.
694694

695-
[//]: # (TODO Update hash value)
696-
697695
```
698-
08d1c40995658e380c7e5d2fec4cebfbfc22b246582719c5451ae708a28b6a09
696+
9537bf4659d3e939b86f0d925dec2eafc1fc533d09c96674791389b09c88e8c9
699697
```
700698

701699
## Public API
@@ -727,35 +725,4 @@ After downloading the zip, you can run the samples in the zip directly by settin
727725
"organization_id": "<YOUR_ORGNIZATION_ID>"
728726
}
729727
}
730-
```
731-
732-
## Public API
733-
734-
PDF Services API is accessible directly via REST APIs which requires Adobe-provided credential for authentication. Once you've completed the [Getting Credentials](https://acrobatservices.adobe.com/dc-integration-creation-app-cdn/main.html?api=pdf-services-api) workflow, a zip file automatically downloads that contains content whose structure varies based on whether you opted to download personalized code samples. The zip file structures are as follows:
735-
736-
- **Personalized Download**: Downloads the zip which contains `adobe-dc-pdf-services-sdk-java-samples` with a preconfigured `pdfservices-api-credentials.json` file.
737-
- **Non Personalized Download**: Downloads the `pdfservices-api-credentials.json` with your preconfigured credentials.
738-
739-
After downloading the zip, you can run the samples in the zip directly by setting up the two environment variables `PDF_SERVICES_CLIENT_ID` and `PDF_SERVICES_CLIENT_SECRET` by running the following cammands :
740-
741-
- **Windows:**
742-
- `set PDF_SERVICES_CLIENT_ID=<YOUR CLIENT ID>`
743-
- `set PDF_SERVICES_CLIENT_SECRET=<YOUR CLIENT SECRET>`
744-
745-
- **MacOS/Linux:**
746-
- `export PDF_SERVICES_CLIENT_ID=<YOUR CLIENT ID>`
747-
- `export PDF_SERVICES_CLIENT_SECRET=<YOUR CLIENT SECRET>`
748-
749-
**Example pdfservices-api-credentials.json file**
750-
751-
```json
752-
{
753-
"client_credentials": {
754-
"client_id": "<YOUR_CLIENT_ID>",
755-
"client_secret": "<YOUR_CLIENT_SECRET>"
756-
},
757-
"service_principal_credentials": {
758-
"organization_id": "<YOUR_ORGNIZATION_ID>"
759-
}
760-
}
761-
```
728+
```

src/pages/overview/pdf-electronic-seal-api/quickstarts/python/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ To complete this guide, you will need:
4545

4646
3) At the command line, change to the directory you created, and run the following command to install the Python SDK: `pip install pdfservices-sdk`.
4747

48-
[//]: # (TODO update this ss )
4948
![alt](shot7.png)
5049

5150
At this point, we've installed the Python SDK for Adobe PDF Services API as a dependency for our project and have copied over our credentials files.
@@ -60,7 +59,7 @@ Now you're ready to begin coding.
6059

6160
1) We'll begin by including our required dependencies:
6261

63-
```javascript
62+
```python
6463
import logging
6564
import os
6665
from datetime import datetime
@@ -93,7 +92,7 @@ from adobe.pdfservices.operation.pdfjobs.result.eseal_pdf_result import ESealPDF
9392

9493
3) Next, we can create our credentials and use them:
9594

96-
```javascript
95+
```python
9796
# Initial setup, create credentials instance
9897
credentials = ServicePrincipalCredentials(
9998
client_id=os.getenv('PDF_SERVICES_CLIENT_ID'),
@@ -105,7 +104,7 @@ pdf_services = PDFServices(credentials=credentials)
105104

106105
4) Now, let's create an asset from source file and upload.
107106

108-
```javascript
107+
```python
109108
pdf_file = open('./sampleInvoice.pdf', 'rb')
110109
file_input_stream = pdf_file.read()
111110
pdf_file.close()
@@ -121,7 +120,7 @@ seal_image_asset = pdf_services.upload(input_stream=seal_image_input_stream, mim
121120

122121
5) Now, let's create the parameters and the job:
123122

124-
```javascript
123+
```python
125124
# Set the document level permission to be applied for output document
126125
document_level_permission = DocumentLevelPermission.FORM_FILLING
127126

@@ -185,7 +184,7 @@ electronic_seal_job = PDFElectronicSealJob(input_asset=asset,
185184

186185
6) The next code block submits the job and gets the job result:
187186

188-
```javascript
187+
```python
189188
# Submit the job and gets the job result
190189
location = pdf_services.submit(electronic_seal_job)
191190
pdf_services_response = pdf_services.get_job_result(location, ESealPDFResult)
@@ -197,15 +196,15 @@ stream_asset: StreamAsset = pdf_services.get_content(result_asset)
197196

198197
7) The next code block saves the result at the specified location:
199198

200-
```javascript
199+
```python
201200
output_file_path = 'output/ElectronicSeal.pdf'
202201
with open(output_file_path, "wb") as file:
203202
file.write(stream_asset.get_input_stream())
204203
```
205204

206205
Here's the complete application (`src/electronicseal/electronic_seal.py`):
207206

208-
```javascript
207+
```python
209208
# Initialize the logger
210209
logging.basicConfig(level=logging.INFO)
211210

0 commit comments

Comments
 (0)