|
82 | 82 | GifPdfRestPayload, |
83 | 83 | JpegPdfRestPayload, |
84 | 84 | OcrPdfPayload, |
| 85 | + PdfBlankPayload, |
85 | 86 | PdfCompressPayload, |
86 | 87 | PdfDecryptPayload, |
87 | 88 | PdfEncryptPayload, |
|
123 | 124 | PdfAType, |
124 | 125 | PdfInfoQuery, |
125 | 126 | PdfMergeInput, |
| 127 | + PdfPageOrientation, |
126 | 128 | PdfPageSelection, |
| 129 | + PdfPageSize, |
127 | 130 | PdfRedactionInstruction, |
128 | 131 | PdfRestriction, |
129 | 132 | PdfRGBColor, |
@@ -1035,8 +1038,9 @@ def _post_file_operation( |
1035 | 1038 | for file_id in output_ids |
1036 | 1039 | ] |
1037 | 1040 |
|
| 1041 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1038 | 1042 | response_payload: dict[str, Any] = { |
1039 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1043 | + "input_id": [str(file_id) for file_id in input_ids], |
1040 | 1044 | "output_file": [ |
1041 | 1045 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1042 | 1046 | ], |
@@ -1310,8 +1314,9 @@ async def throttled_fetch_file_info(file_id: str) -> PdfRestFile: |
1310 | 1314 | ) |
1311 | 1315 | ) |
1312 | 1316 |
|
| 1317 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1313 | 1318 | response_payload: dict[str, Any] = { |
1314 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1319 | + "input_id": [str(file_id) for file_id in input_ids], |
1315 | 1320 | "output_file": [ |
1316 | 1321 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1317 | 1322 | ], |
@@ -2973,6 +2978,45 @@ def compress_pdf( |
2973 | 2978 | timeout=timeout, |
2974 | 2979 | ) |
2975 | 2980 |
|
| 2981 | + def blank_pdf( |
| 2982 | + self, |
| 2983 | + *, |
| 2984 | + page_size: PdfPageSize, |
| 2985 | + page_count: int, |
| 2986 | + page_orientation: PdfPageOrientation | None = None, |
| 2987 | + custom_height: float | None = None, |
| 2988 | + custom_width: float | None = None, |
| 2989 | + output: str | None = None, |
| 2990 | + extra_query: Query | None = None, |
| 2991 | + extra_headers: AnyMapping | None = None, |
| 2992 | + extra_body: Body | None = None, |
| 2993 | + timeout: TimeoutTypes | None = None, |
| 2994 | + ) -> PdfRestFileBasedResponse: |
| 2995 | + """Create a blank PDF with the specified size, count, and orientation.""" |
| 2996 | + |
| 2997 | + payload: dict[str, Any] = { |
| 2998 | + "page_size": page_size, |
| 2999 | + "page_count": page_count, |
| 3000 | + } |
| 3001 | + if page_orientation is not None: |
| 3002 | + payload["page_orientation"] = page_orientation |
| 3003 | + if custom_height is not None: |
| 3004 | + payload["custom_height"] = custom_height |
| 3005 | + if custom_width is not None: |
| 3006 | + payload["custom_width"] = custom_width |
| 3007 | + if output is not None: |
| 3008 | + payload["output"] = output |
| 3009 | + |
| 3010 | + return self._post_file_operation( |
| 3011 | + endpoint="/blank-pdf", |
| 3012 | + payload=payload, |
| 3013 | + payload_model=PdfBlankPayload, |
| 3014 | + extra_query=extra_query, |
| 3015 | + extra_headers=extra_headers, |
| 3016 | + extra_body=extra_body, |
| 3017 | + timeout=timeout, |
| 3018 | + ) |
| 3019 | + |
2976 | 3020 | def flatten_transparencies( |
2977 | 3021 | self, |
2978 | 3022 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -4260,6 +4304,45 @@ async def compress_pdf( |
4260 | 4304 | timeout=timeout, |
4261 | 4305 | ) |
4262 | 4306 |
|
| 4307 | + async def blank_pdf( |
| 4308 | + self, |
| 4309 | + *, |
| 4310 | + page_size: PdfPageSize, |
| 4311 | + page_count: int, |
| 4312 | + page_orientation: PdfPageOrientation | None = None, |
| 4313 | + custom_height: float | None = None, |
| 4314 | + custom_width: float | None = None, |
| 4315 | + output: str | None = None, |
| 4316 | + extra_query: Query | None = None, |
| 4317 | + extra_headers: AnyMapping | None = None, |
| 4318 | + extra_body: Body | None = None, |
| 4319 | + timeout: TimeoutTypes | None = None, |
| 4320 | + ) -> PdfRestFileBasedResponse: |
| 4321 | + """Asynchronously create a blank PDF with the specified size.""" |
| 4322 | + |
| 4323 | + payload: dict[str, Any] = { |
| 4324 | + "page_size": page_size, |
| 4325 | + "page_count": page_count, |
| 4326 | + } |
| 4327 | + if page_orientation is not None: |
| 4328 | + payload["page_orientation"] = page_orientation |
| 4329 | + if custom_height is not None: |
| 4330 | + payload["custom_height"] = custom_height |
| 4331 | + if custom_width is not None: |
| 4332 | + payload["custom_width"] = custom_width |
| 4333 | + if output is not None: |
| 4334 | + payload["output"] = output |
| 4335 | + |
| 4336 | + return await self._post_file_operation( |
| 4337 | + endpoint="/blank-pdf", |
| 4338 | + payload=payload, |
| 4339 | + payload_model=PdfBlankPayload, |
| 4340 | + extra_query=extra_query, |
| 4341 | + extra_headers=extra_headers, |
| 4342 | + extra_body=extra_body, |
| 4343 | + timeout=timeout, |
| 4344 | + ) |
| 4345 | + |
4263 | 4346 | async def flatten_transparencies( |
4264 | 4347 | self, |
4265 | 4348 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments