|
25 | 25 | send_request, |
26 | 26 | ) |
27 | 27 | from nutrient_dws.inputs import ( |
28 | | - FileInputWithUrl, |
| 28 | + FileInput, |
29 | 29 | LocalFileInput, |
30 | 30 | is_valid_pdf, |
31 | 31 | process_file_input, |
@@ -400,7 +400,7 @@ async def sign( |
400 | 400 |
|
401 | 401 | async def watermark_text( |
402 | 402 | self, |
403 | | - file: FileInputWithUrl, |
| 403 | + file: FileInput, |
404 | 404 | text: str, |
405 | 405 | options: TextWatermarkActionOptions | None = None, |
406 | 406 | ) -> BufferOutput: |
@@ -444,8 +444,8 @@ async def watermark_text( |
444 | 444 |
|
445 | 445 | async def watermark_image( |
446 | 446 | self, |
447 | | - file: FileInputWithUrl, |
448 | | - image: FileInputWithUrl, |
| 447 | + file: FileInput, |
| 448 | + image: FileInput, |
449 | 449 | options: ImageWatermarkActionOptions | None = None, |
450 | 450 | ) -> BufferOutput: |
451 | 451 | """Add an image watermark to a document. |
@@ -497,7 +497,7 @@ async def watermark_image( |
497 | 497 |
|
498 | 498 | async def convert( |
499 | 499 | self, |
500 | | - file: FileInputWithUrl, |
| 500 | + file: FileInput, |
501 | 501 | target_format: OutputFormat, |
502 | 502 | ) -> BufferOutput | ContentOutput | JsonContentOutput: |
503 | 503 | """Convert a document to a different format. |
@@ -560,7 +560,7 @@ async def convert( |
560 | 560 |
|
561 | 561 | async def ocr( |
562 | 562 | self, |
563 | | - file: FileInputWithUrl, |
| 563 | + file: FileInput, |
564 | 564 | language: OcrLanguage | list[OcrLanguage], |
565 | 565 | ) -> BufferOutput: |
566 | 566 | """Perform OCR (Optical Character Recognition) on a document. |
@@ -597,7 +597,7 @@ async def ocr( |
597 | 597 |
|
598 | 598 | async def extract_text( |
599 | 599 | self, |
600 | | - file: FileInputWithUrl, |
| 600 | + file: FileInput, |
601 | 601 | pages: PageRange | None = None, |
602 | 602 | ) -> JsonContentOutput: |
603 | 603 | """Extract text content from a document. |
@@ -648,7 +648,7 @@ async def extract_text( |
648 | 648 |
|
649 | 649 | async def extract_table( |
650 | 650 | self, |
651 | | - file: FileInputWithUrl, |
| 651 | + file: FileInput, |
652 | 652 | pages: PageRange | None = None, |
653 | 653 | ) -> JsonContentOutput: |
654 | 654 | """Extract table content from a document. |
@@ -700,7 +700,7 @@ async def extract_table( |
700 | 700 |
|
701 | 701 | async def extract_key_value_pairs( |
702 | 702 | self, |
703 | | - file: FileInputWithUrl, |
| 703 | + file: FileInput, |
704 | 704 | pages: PageRange | None = None, |
705 | 705 | ) -> JsonContentOutput: |
706 | 706 | """Extract key value pair content from a document. |
@@ -755,7 +755,7 @@ async def extract_key_value_pairs( |
755 | 755 |
|
756 | 756 | async def set_page_labels( |
757 | 757 | self, |
758 | | - pdf: FileInputWithUrl, |
| 758 | + pdf: FileInput, |
759 | 759 | labels: list[Label], |
760 | 760 | ) -> BufferOutput: |
761 | 761 | """Set page labels for a PDF document. |
@@ -794,7 +794,7 @@ async def set_page_labels( |
794 | 794 |
|
795 | 795 | async def password_protect( |
796 | 796 | self, |
797 | | - file: FileInputWithUrl, |
| 797 | + file: FileInput, |
798 | 798 | user_password: str, |
799 | 799 | owner_password: str, |
800 | 800 | permissions: list[PDFUserPermission] | None = None, |
@@ -842,7 +842,7 @@ async def password_protect( |
842 | 842 |
|
843 | 843 | async def set_metadata( |
844 | 844 | self, |
845 | | - pdf: FileInputWithUrl, |
| 845 | + pdf: FileInput, |
846 | 846 | metadata: Metadata, |
847 | 847 | ) -> BufferOutput: |
848 | 848 | """Set metadata for a PDF document. |
@@ -881,8 +881,8 @@ async def set_metadata( |
881 | 881 |
|
882 | 882 | async def apply_instant_json( |
883 | 883 | self, |
884 | | - pdf: FileInputWithUrl, |
885 | | - instant_json_file: FileInputWithUrl, |
| 884 | + pdf: FileInput, |
| 885 | + instant_json_file: FileInput, |
886 | 886 | ) -> BufferOutput: |
887 | 887 | """Apply Instant JSON to a document. |
888 | 888 | This is a convenience method that uses the workflow builder. |
@@ -922,8 +922,8 @@ async def apply_instant_json( |
922 | 922 |
|
923 | 923 | async def apply_xfdf( |
924 | 924 | self, |
925 | | - pdf: FileInputWithUrl, |
926 | | - xfdf_file: FileInputWithUrl, |
| 925 | + pdf: FileInput, |
| 926 | + xfdf_file: FileInput, |
927 | 927 | options: ApplyXfdfActionOptions | None = None, |
928 | 928 | ) -> BufferOutput: |
929 | 929 | """Apply XFDF to a document. |
@@ -969,7 +969,7 @@ async def apply_xfdf( |
969 | 969 |
|
970 | 970 | return cast("BufferOutput", self._process_typed_workflow_result(result)) |
971 | 971 |
|
972 | | - async def merge(self, files: list[FileInputWithUrl]) -> BufferOutput: |
| 972 | + async def merge(self, files: list[FileInput]) -> BufferOutput: |
973 | 973 | """Merge multiple documents into a single document. |
974 | 974 | This is a convenience method that uses the workflow builder. |
975 | 975 |
|
@@ -1013,7 +1013,7 @@ async def merge(self, files: list[FileInputWithUrl]) -> BufferOutput: |
1013 | 1013 |
|
1014 | 1014 | async def flatten( |
1015 | 1015 | self, |
1016 | | - pdf: FileInputWithUrl, |
| 1016 | + pdf: FileInput, |
1017 | 1017 | annotation_ids: list[str | int] | None = None, |
1018 | 1018 | ) -> BufferOutput: |
1019 | 1019 | """Flatten annotations in a PDF document. |
@@ -1147,7 +1147,7 @@ async def create_redactions_ai( |
1147 | 1147 |
|
1148 | 1148 | async def create_redactions_preset( |
1149 | 1149 | self, |
1150 | | - pdf: FileInputWithUrl, |
| 1150 | + pdf: FileInput, |
1151 | 1151 | preset: SearchPreset, |
1152 | 1152 | redaction_state: Literal["stage", "apply"] = "stage", |
1153 | 1153 | pages: PageRange | None = None, |
@@ -1213,7 +1213,7 @@ async def create_redactions_preset( |
1213 | 1213 |
|
1214 | 1214 | async def create_redactions_regex( |
1215 | 1215 | self, |
1216 | | - pdf: FileInputWithUrl, |
| 1216 | + pdf: FileInput, |
1217 | 1217 | regex: str, |
1218 | 1218 | redaction_state: Literal["stage", "apply"] = "stage", |
1219 | 1219 | pages: PageRange | None = None, |
@@ -1279,7 +1279,7 @@ async def create_redactions_regex( |
1279 | 1279 |
|
1280 | 1280 | async def create_redactions_text( |
1281 | 1281 | self, |
1282 | | - pdf: FileInputWithUrl, |
| 1282 | + pdf: FileInput, |
1283 | 1283 | text: str, |
1284 | 1284 | redaction_state: Literal["stage", "apply"] = "stage", |
1285 | 1285 | pages: PageRange | None = None, |
@@ -1343,7 +1343,7 @@ async def create_redactions_text( |
1343 | 1343 |
|
1344 | 1344 | return cast("BufferOutput", self._process_typed_workflow_result(result)) |
1345 | 1345 |
|
1346 | | - async def apply_redactions(self, pdf: FileInputWithUrl) -> BufferOutput: |
| 1346 | + async def apply_redactions(self, pdf: FileInput) -> BufferOutput: |
1347 | 1347 | """Apply staged redaction into the PDF. |
1348 | 1348 |
|
1349 | 1349 | **Note**: URLs are passed to the server for secure server-side fetching. |
@@ -1380,7 +1380,7 @@ async def apply_redactions(self, pdf: FileInputWithUrl) -> BufferOutput: |
1380 | 1380 |
|
1381 | 1381 | async def rotate( |
1382 | 1382 | self, |
1383 | | - pdf: FileInputWithUrl, |
| 1383 | + pdf: FileInput, |
1384 | 1384 | angle: Literal[90, 180, 270], |
1385 | 1385 | pages: PageRange | None = None, |
1386 | 1386 | ) -> BufferOutput: |
@@ -1451,7 +1451,7 @@ async def rotate( |
1451 | 1451 | return cast("BufferOutput", self._process_typed_workflow_result(result)) |
1452 | 1452 |
|
1453 | 1453 | async def add_page( |
1454 | | - self, pdf: FileInputWithUrl, count: int = 1, index: int | None = None |
| 1454 | + self, pdf: FileInput, count: int = 1, index: int | None = None |
1455 | 1455 | ) -> BufferOutput: |
1456 | 1456 | """Add blank pages to a document. |
1457 | 1457 | This is a convenience method that uses the workflow builder. |
@@ -1514,7 +1514,7 @@ async def add_page( |
1514 | 1514 | return cast("BufferOutput", self._process_typed_workflow_result(result)) |
1515 | 1515 |
|
1516 | 1516 | async def split( |
1517 | | - self, pdf: FileInputWithUrl, page_ranges: list[PageRange] |
| 1517 | + self, pdf: FileInput, page_ranges: list[PageRange] |
1518 | 1518 | ) -> list[BufferOutput]: |
1519 | 1519 | """Split a PDF document into multiple parts based on page ranges. |
1520 | 1520 | This is a convenience method that uses the workflow builder. |
@@ -1569,7 +1569,7 @@ async def create_split_pdf(page_range: PageRange) -> BufferOutput: |
1569 | 1569 | return results |
1570 | 1570 |
|
1571 | 1571 | async def duplicate_pages( |
1572 | | - self, pdf: FileInputWithUrl, page_indices: list[int] |
| 1572 | + self, pdf: FileInput, page_indices: list[int] |
1573 | 1573 | ) -> BufferOutput: |
1574 | 1574 | """Create a new PDF containing only the specified pages in the order provided. |
1575 | 1575 | This is a convenience method that uses the workflow builder. |
@@ -1620,7 +1620,7 @@ async def duplicate_pages( |
1620 | 1620 | return cast("BufferOutput", self._process_typed_workflow_result(result)) |
1621 | 1621 |
|
1622 | 1622 | async def delete_pages( |
1623 | | - self, pdf: FileInputWithUrl, page_indices: list[int] |
| 1623 | + self, pdf: FileInput, page_indices: list[int] |
1624 | 1624 | ) -> BufferOutput: |
1625 | 1625 | """Delete pages from a PDF document. |
1626 | 1626 | This is a convenience method that uses the workflow builder. |
@@ -1699,7 +1699,7 @@ async def delete_pages( |
1699 | 1699 |
|
1700 | 1700 | async def optimize( |
1701 | 1701 | self, |
1702 | | - pdf: FileInputWithUrl, |
| 1702 | + pdf: FileInput, |
1703 | 1703 | options: OptimizePdf | None = None, |
1704 | 1704 | ) -> BufferOutput: |
1705 | 1705 | """Optimize a PDF document for size reduction. |
|
0 commit comments