|
81 | 81 | GifPdfRestPayload, |
82 | 82 | JpegPdfRestPayload, |
83 | 83 | OcrPdfPayload, |
| 84 | + PdfBlankPayload, |
84 | 85 | PdfCompressPayload, |
85 | 86 | PdfConvertColorsPayload, |
86 | 87 | PdfFlattenAnnotationsPayload, |
|
121 | 122 | PdfColorProfile, |
122 | 123 | PdfInfoQuery, |
123 | 124 | PdfMergeInput, |
| 125 | + PdfPageOrientation, |
124 | 126 | PdfPageSelection, |
| 127 | + PdfPageSize, |
125 | 128 | PdfRedactionInstruction, |
126 | 129 | PdfRGBColor, |
127 | 130 | PdfXType, |
@@ -1032,8 +1035,9 @@ def _post_file_operation( |
1032 | 1035 | for file_id in output_ids |
1033 | 1036 | ] |
1034 | 1037 |
|
| 1038 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1035 | 1039 | response_payload: dict[str, Any] = { |
1036 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1040 | + "input_id": [str(file_id) for file_id in input_ids], |
1037 | 1041 | "output_file": [ |
1038 | 1042 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1039 | 1043 | ], |
@@ -1307,8 +1311,9 @@ async def throttled_fetch_file_info(file_id: str) -> PdfRestFile: |
1307 | 1311 | ) |
1308 | 1312 | ) |
1309 | 1313 |
|
| 1314 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1310 | 1315 | response_payload: dict[str, Any] = { |
1311 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1316 | + "input_id": [str(file_id) for file_id in input_ids], |
1312 | 1317 | "output_file": [ |
1313 | 1318 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1314 | 1319 | ], |
@@ -2755,6 +2760,45 @@ def convert_colors( |
2755 | 2760 | timeout=timeout, |
2756 | 2761 | ) |
2757 | 2762 |
|
| 2763 | + def blank_pdf( |
| 2764 | + self, |
| 2765 | + *, |
| 2766 | + page_size: PdfPageSize, |
| 2767 | + page_count: int, |
| 2768 | + page_orientation: PdfPageOrientation | None = None, |
| 2769 | + custom_height: float | None = None, |
| 2770 | + custom_width: float | None = None, |
| 2771 | + output: str | None = None, |
| 2772 | + extra_query: Query | None = None, |
| 2773 | + extra_headers: AnyMapping | None = None, |
| 2774 | + extra_body: Body | None = None, |
| 2775 | + timeout: TimeoutTypes | None = None, |
| 2776 | + ) -> PdfRestFileBasedResponse: |
| 2777 | + """Create a blank PDF with the specified size, count, and orientation.""" |
| 2778 | + |
| 2779 | + payload: dict[str, Any] = { |
| 2780 | + "page_size": page_size, |
| 2781 | + "page_count": page_count, |
| 2782 | + } |
| 2783 | + if page_orientation is not None: |
| 2784 | + payload["page_orientation"] = page_orientation |
| 2785 | + if custom_height is not None: |
| 2786 | + payload["custom_height"] = custom_height |
| 2787 | + if custom_width is not None: |
| 2788 | + payload["custom_width"] = custom_width |
| 2789 | + if output is not None: |
| 2790 | + payload["output"] = output |
| 2791 | + |
| 2792 | + return self._post_file_operation( |
| 2793 | + endpoint="/blank-pdf", |
| 2794 | + payload=payload, |
| 2795 | + payload_model=PdfBlankPayload, |
| 2796 | + extra_query=extra_query, |
| 2797 | + extra_headers=extra_headers, |
| 2798 | + extra_body=extra_body, |
| 2799 | + timeout=timeout, |
| 2800 | + ) |
| 2801 | + |
2758 | 2802 | def flatten_transparencies( |
2759 | 2803 | self, |
2760 | 2804 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -3858,6 +3902,45 @@ async def convert_colors( |
3858 | 3902 | timeout=timeout, |
3859 | 3903 | ) |
3860 | 3904 |
|
| 3905 | + async def blank_pdf( |
| 3906 | + self, |
| 3907 | + *, |
| 3908 | + page_size: PdfPageSize, |
| 3909 | + page_count: int, |
| 3910 | + page_orientation: PdfPageOrientation | None = None, |
| 3911 | + custom_height: float | None = None, |
| 3912 | + custom_width: float | None = None, |
| 3913 | + output: str | None = None, |
| 3914 | + extra_query: Query | None = None, |
| 3915 | + extra_headers: AnyMapping | None = None, |
| 3916 | + extra_body: Body | None = None, |
| 3917 | + timeout: TimeoutTypes | None = None, |
| 3918 | + ) -> PdfRestFileBasedResponse: |
| 3919 | + """Asynchronously create a blank PDF with the specified size.""" |
| 3920 | + |
| 3921 | + payload: dict[str, Any] = { |
| 3922 | + "page_size": page_size, |
| 3923 | + "page_count": page_count, |
| 3924 | + } |
| 3925 | + if page_orientation is not None: |
| 3926 | + payload["page_orientation"] = page_orientation |
| 3927 | + if custom_height is not None: |
| 3928 | + payload["custom_height"] = custom_height |
| 3929 | + if custom_width is not None: |
| 3930 | + payload["custom_width"] = custom_width |
| 3931 | + if output is not None: |
| 3932 | + payload["output"] = output |
| 3933 | + |
| 3934 | + return await self._post_file_operation( |
| 3935 | + endpoint="/blank-pdf", |
| 3936 | + payload=payload, |
| 3937 | + payload_model=PdfBlankPayload, |
| 3938 | + extra_query=extra_query, |
| 3939 | + extra_headers=extra_headers, |
| 3940 | + extra_body=extra_body, |
| 3941 | + timeout=timeout, |
| 3942 | + ) |
| 3943 | + |
3861 | 3944 | async def flatten_transparencies( |
3862 | 3945 | self, |
3863 | 3946 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments