Spaces:
Runtime error
Runtime error
Update InitialMarkups.py
Browse files- InitialMarkups.py +9 -4
InitialMarkups.py
CHANGED
|
@@ -2432,6 +2432,8 @@ def extract_section_under_header_tobebilledMultiplePDFSmarthe(multiplePDF_Paths)
|
|
| 2432 |
arrayofPDFS=multiplePDF_Paths.split(',')
|
| 2433 |
print(multiplePDF_Paths)
|
| 2434 |
print(arrayofPDFS)
|
|
|
|
|
|
|
| 2435 |
df = pd.DataFrame(columns=["PDF Name","NBSLink","Subject","Page","Author","Creation Date","Layer",'Code', 'head above 1', "head above 2","BodyText"])
|
| 2436 |
for pdf_path in arrayofPDFS:
|
| 2437 |
headertoContinue1 = False
|
|
@@ -2875,18 +2877,21 @@ def extract_section_under_header_tobebilledMultiplePDFSmarthe(multiplePDF_Paths)
|
|
| 2875 |
else:
|
| 2876 |
stringtowrite='To be billed'
|
| 2877 |
highlight_boxes(docHighlights, page_highlights,stringtowrite)
|
| 2878 |
-
|
|
|
|
| 2879 |
# docHighlights.save("highlighted_output.pdf", garbage=4, deflate=True)
|
| 2880 |
|
| 2881 |
dbxTeam = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 2882 |
dbPath = '/TSA JOBS/ADR Test/FIND/'
|
| 2883 |
jsonCombined=[]
|
| 2884 |
-
for
|
|
|
|
|
|
|
| 2885 |
metadata = dbxTeam.sharing_get_shared_link_metadata(singlepdf)
|
| 2886 |
pdf_bytes = BytesIO()
|
| 2887 |
docHighlights.save(pdf_bytes)
|
| 2888 |
-
pdflink = tsadropboxretrieval.uploadanyFile(doc=
|
| 2889 |
-
json_output1=changepdflinks(
|
| 2890 |
jsonCombined.extend(json_output1)
|
| 2891 |
combined_json_str = json.dumps(jsonCombined, indent=1)
|
| 2892 |
print(combined_json_str)
|
|
|
|
| 2432 |
arrayofPDFS=multiplePDF_Paths.split(',')
|
| 2433 |
print(multiplePDF_Paths)
|
| 2434 |
print(arrayofPDFS)
|
| 2435 |
+
docarray=[]
|
| 2436 |
+
jsons=[]
|
| 2437 |
df = pd.DataFrame(columns=["PDF Name","NBSLink","Subject","Page","Author","Creation Date","Layer",'Code', 'head above 1', "head above 2","BodyText"])
|
| 2438 |
for pdf_path in arrayofPDFS:
|
| 2439 |
headertoContinue1 = False
|
|
|
|
| 2877 |
else:
|
| 2878 |
stringtowrite='To be billed'
|
| 2879 |
highlight_boxes(docHighlights, page_highlights,stringtowrite)
|
| 2880 |
+
docarray.append(docHighlights)
|
| 2881 |
+
jsons.extend(json_output)
|
| 2882 |
# docHighlights.save("highlighted_output.pdf", garbage=4, deflate=True)
|
| 2883 |
|
| 2884 |
dbxTeam = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 2885 |
dbPath = '/TSA JOBS/ADR Test/FIND/'
|
| 2886 |
jsonCombined=[]
|
| 2887 |
+
for i in rangeof(len(arrayofPDFS):
|
| 2888 |
+
singlepdf=arrayofPDFS[i]
|
| 2889 |
+
|
| 2890 |
metadata = dbxTeam.sharing_get_shared_link_metadata(singlepdf)
|
| 2891 |
pdf_bytes = BytesIO()
|
| 2892 |
docHighlights.save(pdf_bytes)
|
| 2893 |
+
pdflink = tsadropboxretrieval.uploadanyFile(doc=docarray[i], path=dbPath, pdfname=filenames[i])
|
| 2894 |
+
json_output1=changepdflinks(jsons[i],pdflink)
|
| 2895 |
jsonCombined.extend(json_output1)
|
| 2896 |
combined_json_str = json.dumps(jsonCombined, indent=1)
|
| 2897 |
print(combined_json_str)
|