|
81 | 81 | GifPdfRestPayload, |
82 | 82 | JpegPdfRestPayload, |
83 | 83 | OcrPdfPayload, |
| 84 | + PdfBlankPayload, |
84 | 85 | PdfCompressPayload, |
85 | 86 | PdfFlattenAnnotationsPayload, |
86 | 87 | PdfFlattenFormsPayload, |
|
118 | 119 | PdfAType, |
119 | 120 | PdfInfoQuery, |
120 | 121 | PdfMergeInput, |
| 122 | + PdfPageOrientation, |
121 | 123 | PdfPageSelection, |
| 124 | + PdfPageSize, |
122 | 125 | PdfRedactionInstruction, |
123 | 126 | PdfRGBColor, |
124 | 127 | PdfXType, |
@@ -1029,8 +1032,9 @@ def _post_file_operation( |
1029 | 1032 | for file_id in output_ids |
1030 | 1033 | ] |
1031 | 1034 |
|
| 1035 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1032 | 1036 | response_payload: dict[str, Any] = { |
1033 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1037 | + "input_id": [str(file_id) for file_id in input_ids], |
1034 | 1038 | "output_file": [ |
1035 | 1039 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1036 | 1040 | ], |
@@ -1304,8 +1308,9 @@ async def throttled_fetch_file_info(file_id: str) -> PdfRestFile: |
1304 | 1308 | ) |
1305 | 1309 | ) |
1306 | 1310 |
|
| 1311 | + input_ids = raw_response.input_id or (raw_response.ids or []) |
1307 | 1312 | response_payload: dict[str, Any] = { |
1308 | | - "input_id": [str(file_id) for file_id in raw_response.input_id], |
| 1313 | + "input_id": [str(file_id) for file_id in input_ids], |
1309 | 1314 | "output_file": [ |
1310 | 1315 | file.model_dump(mode="json", by_alias=True) for file in output_files |
1311 | 1316 | ], |
@@ -2717,6 +2722,45 @@ def compress_pdf( |
2717 | 2722 | timeout=timeout, |
2718 | 2723 | ) |
2719 | 2724 |
|
| 2725 | + def blank_pdf( |
| 2726 | + self, |
| 2727 | + *, |
| 2728 | + page_size: PdfPageSize, |
| 2729 | + page_count: int, |
| 2730 | + page_orientation: PdfPageOrientation | None = None, |
| 2731 | + custom_height: float | None = None, |
| 2732 | + custom_width: float | None = None, |
| 2733 | + output: str | None = None, |
| 2734 | + extra_query: Query | None = None, |
| 2735 | + extra_headers: AnyMapping | None = None, |
| 2736 | + extra_body: Body | None = None, |
| 2737 | + timeout: TimeoutTypes | None = None, |
| 2738 | + ) -> PdfRestFileBasedResponse: |
| 2739 | + """Create a blank PDF with the specified size, count, and orientation.""" |
| 2740 | + |
| 2741 | + payload: dict[str, Any] = { |
| 2742 | + "page_size": page_size, |
| 2743 | + "page_count": page_count, |
| 2744 | + } |
| 2745 | + if page_orientation is not None: |
| 2746 | + payload["page_orientation"] = page_orientation |
| 2747 | + if custom_height is not None: |
| 2748 | + payload["custom_height"] = custom_height |
| 2749 | + if custom_width is not None: |
| 2750 | + payload["custom_width"] = custom_width |
| 2751 | + if output is not None: |
| 2752 | + payload["output"] = output |
| 2753 | + |
| 2754 | + return self._post_file_operation( |
| 2755 | + endpoint="/blank-pdf", |
| 2756 | + payload=payload, |
| 2757 | + payload_model=PdfBlankPayload, |
| 2758 | + extra_query=extra_query, |
| 2759 | + extra_headers=extra_headers, |
| 2760 | + extra_body=extra_body, |
| 2761 | + timeout=timeout, |
| 2762 | + ) |
| 2763 | + |
2720 | 2764 | def flatten_transparencies( |
2721 | 2765 | self, |
2722 | 2766 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -3754,6 +3798,45 @@ async def compress_pdf( |
3754 | 3798 | timeout=timeout, |
3755 | 3799 | ) |
3756 | 3800 |
|
| 3801 | + async def blank_pdf( |
| 3802 | + self, |
| 3803 | + *, |
| 3804 | + page_size: PdfPageSize, |
| 3805 | + page_count: int, |
| 3806 | + page_orientation: PdfPageOrientation | None = None, |
| 3807 | + custom_height: float | None = None, |
| 3808 | + custom_width: float | None = None, |
| 3809 | + output: str | None = None, |
| 3810 | + extra_query: Query | None = None, |
| 3811 | + extra_headers: AnyMapping | None = None, |
| 3812 | + extra_body: Body | None = None, |
| 3813 | + timeout: TimeoutTypes | None = None, |
| 3814 | + ) -> PdfRestFileBasedResponse: |
| 3815 | + """Asynchronously create a blank PDF with the specified size.""" |
| 3816 | + |
| 3817 | + payload: dict[str, Any] = { |
| 3818 | + "page_size": page_size, |
| 3819 | + "page_count": page_count, |
| 3820 | + } |
| 3821 | + if page_orientation is not None: |
| 3822 | + payload["page_orientation"] = page_orientation |
| 3823 | + if custom_height is not None: |
| 3824 | + payload["custom_height"] = custom_height |
| 3825 | + if custom_width is not None: |
| 3826 | + payload["custom_width"] = custom_width |
| 3827 | + if output is not None: |
| 3828 | + payload["output"] = output |
| 3829 | + |
| 3830 | + return await self._post_file_operation( |
| 3831 | + endpoint="/blank-pdf", |
| 3832 | + payload=payload, |
| 3833 | + payload_model=PdfBlankPayload, |
| 3834 | + extra_query=extra_query, |
| 3835 | + extra_headers=extra_headers, |
| 3836 | + extra_body=extra_body, |
| 3837 | + timeout=timeout, |
| 3838 | + ) |
| 3839 | + |
3757 | 3840 | async def flatten_transparencies( |
3758 | 3841 | self, |
3759 | 3842 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments