|
76 | 76 | BasePdfRestGraphicPayload, |
77 | 77 | BmpPdfRestPayload, |
78 | 78 | ConvertToMarkdownPayload, |
| 79 | + ConvertToPdfPayload, |
| 80 | + ConvertUrlsToPdfPayload, |
79 | 81 | DeletePayload, |
80 | 82 | ExtractImagesPayload, |
81 | 83 | ExtractTextPayload, |
|
125 | 127 | FlattenQuality, |
126 | 128 | GifColorModel, |
127 | 129 | GraphicSmoothing, |
| 130 | + HtmlPageOrientation, |
| 131 | + HtmlPageSize, |
| 132 | + HtmlWebLayout, |
128 | 133 | JpegColorModel, |
129 | 134 | OcrLanguage, |
130 | 135 | PdfAddTextObject, |
131 | 136 | PdfAType, |
| 137 | + PdfConversionCompression, |
| 138 | + PdfConversionDownsample, |
| 139 | + PdfConversionLocale, |
132 | 140 | PdfInfoQuery, |
133 | 141 | PdfMergeInput, |
134 | 142 | PdfPageOrientation, |
@@ -3292,6 +3300,100 @@ def rasterize_pdf( |
3292 | 3300 | timeout=timeout, |
3293 | 3301 | ) |
3294 | 3302 |
|
| 3303 | + def convert_to_pdf( |
| 3304 | + self, |
| 3305 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 3306 | + *, |
| 3307 | + output: str | None = None, |
| 3308 | + compression: PdfConversionCompression | None = None, |
| 3309 | + downsample: PdfConversionDownsample | None = None, |
| 3310 | + tagged_pdf: bool | None = None, |
| 3311 | + locale: PdfConversionLocale | None = None, |
| 3312 | + page_size: HtmlPageSize | None = None, |
| 3313 | + page_margin: str | None = None, |
| 3314 | + page_orientation: HtmlPageOrientation | None = None, |
| 3315 | + web_layout: HtmlWebLayout | None = None, |
| 3316 | + extra_query: Query | None = None, |
| 3317 | + extra_headers: AnyMapping | None = None, |
| 3318 | + extra_body: Body | None = None, |
| 3319 | + timeout: TimeoutTypes | None = None, |
| 3320 | + ) -> PdfRestFileBasedResponse: |
| 3321 | + """Convert a supported file type to PDF.""" |
| 3322 | + |
| 3323 | + payload: dict[str, Any] = {"files": file} |
| 3324 | + if output is not None: |
| 3325 | + payload["output"] = output |
| 3326 | + if compression is not None: |
| 3327 | + payload["compression"] = compression |
| 3328 | + if downsample is not None: |
| 3329 | + payload["downsample"] = downsample |
| 3330 | + if tagged_pdf is not None: |
| 3331 | + payload["tagged_pdf"] = tagged_pdf |
| 3332 | + if locale is not None: |
| 3333 | + payload["locale"] = locale |
| 3334 | + if page_size is not None: |
| 3335 | + payload["page_size"] = page_size |
| 3336 | + if page_margin is not None: |
| 3337 | + payload["page_margin"] = page_margin |
| 3338 | + if page_orientation is not None: |
| 3339 | + payload["page_orientation"] = page_orientation |
| 3340 | + if web_layout is not None: |
| 3341 | + payload["web_layout"] = web_layout |
| 3342 | + |
| 3343 | + return self._post_file_operation( |
| 3344 | + endpoint="/pdf", |
| 3345 | + payload=payload, |
| 3346 | + payload_model=ConvertToPdfPayload, |
| 3347 | + extra_query=extra_query, |
| 3348 | + extra_headers=extra_headers, |
| 3349 | + extra_body=extra_body, |
| 3350 | + timeout=timeout, |
| 3351 | + ) |
| 3352 | + |
| 3353 | + def convert_urls_to_pdf( |
| 3354 | + self, |
| 3355 | + urls: UrlInput, |
| 3356 | + *, |
| 3357 | + output: str | None = None, |
| 3358 | + compression: PdfConversionCompression | None = None, |
| 3359 | + downsample: PdfConversionDownsample | None = None, |
| 3360 | + page_size: HtmlPageSize | None = None, |
| 3361 | + page_margin: str | None = None, |
| 3362 | + page_orientation: HtmlPageOrientation | None = None, |
| 3363 | + web_layout: HtmlWebLayout | None = None, |
| 3364 | + extra_query: Query | None = None, |
| 3365 | + extra_headers: AnyMapping | None = None, |
| 3366 | + extra_body: Body | None = None, |
| 3367 | + timeout: TimeoutTypes | None = None, |
| 3368 | + ) -> PdfRestFileBasedResponse: |
| 3369 | + """Convert HTML content from one or more URLs to PDF.""" |
| 3370 | + |
| 3371 | + payload: dict[str, Any] = {"url": urls} |
| 3372 | + if output is not None: |
| 3373 | + payload["output"] = output |
| 3374 | + if compression is not None: |
| 3375 | + payload["compression"] = compression |
| 3376 | + if downsample is not None: |
| 3377 | + payload["downsample"] = downsample |
| 3378 | + if page_size is not None: |
| 3379 | + payload["page_size"] = page_size |
| 3380 | + if page_margin is not None: |
| 3381 | + payload["page_margin"] = page_margin |
| 3382 | + if page_orientation is not None: |
| 3383 | + payload["page_orientation"] = page_orientation |
| 3384 | + if web_layout is not None: |
| 3385 | + payload["web_layout"] = web_layout |
| 3386 | + |
| 3387 | + return self._post_file_operation( |
| 3388 | + endpoint="/pdf", |
| 3389 | + payload=payload, |
| 3390 | + payload_model=ConvertUrlsToPdfPayload, |
| 3391 | + extra_query=extra_query, |
| 3392 | + extra_headers=extra_headers, |
| 3393 | + extra_body=extra_body, |
| 3394 | + timeout=timeout, |
| 3395 | + ) |
| 3396 | + |
3295 | 3397 | def convert_to_pdfa( |
3296 | 3398 | self, |
3297 | 3399 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -4783,6 +4885,100 @@ async def rasterize_pdf( |
4783 | 4885 | timeout=timeout, |
4784 | 4886 | ) |
4785 | 4887 |
|
| 4888 | + async def convert_to_pdf( |
| 4889 | + self, |
| 4890 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 4891 | + *, |
| 4892 | + output: str | None = None, |
| 4893 | + compression: PdfConversionCompression | None = None, |
| 4894 | + downsample: PdfConversionDownsample | None = None, |
| 4895 | + tagged_pdf: bool | None = None, |
| 4896 | + locale: PdfConversionLocale | None = None, |
| 4897 | + page_size: HtmlPageSize | None = None, |
| 4898 | + page_margin: str | None = None, |
| 4899 | + page_orientation: HtmlPageOrientation | None = None, |
| 4900 | + web_layout: HtmlWebLayout | None = None, |
| 4901 | + extra_query: Query | None = None, |
| 4902 | + extra_headers: AnyMapping | None = None, |
| 4903 | + extra_body: Body | None = None, |
| 4904 | + timeout: TimeoutTypes | None = None, |
| 4905 | + ) -> PdfRestFileBasedResponse: |
| 4906 | + """Asynchronously convert a supported file type to PDF.""" |
| 4907 | + |
| 4908 | + payload: dict[str, Any] = {"files": file} |
| 4909 | + if output is not None: |
| 4910 | + payload["output"] = output |
| 4911 | + if compression is not None: |
| 4912 | + payload["compression"] = compression |
| 4913 | + if downsample is not None: |
| 4914 | + payload["downsample"] = downsample |
| 4915 | + if tagged_pdf is not None: |
| 4916 | + payload["tagged_pdf"] = tagged_pdf |
| 4917 | + if locale is not None: |
| 4918 | + payload["locale"] = locale |
| 4919 | + if page_size is not None: |
| 4920 | + payload["page_size"] = page_size |
| 4921 | + if page_margin is not None: |
| 4922 | + payload["page_margin"] = page_margin |
| 4923 | + if page_orientation is not None: |
| 4924 | + payload["page_orientation"] = page_orientation |
| 4925 | + if web_layout is not None: |
| 4926 | + payload["web_layout"] = web_layout |
| 4927 | + |
| 4928 | + return await self._post_file_operation( |
| 4929 | + endpoint="/pdf", |
| 4930 | + payload=payload, |
| 4931 | + payload_model=ConvertToPdfPayload, |
| 4932 | + extra_query=extra_query, |
| 4933 | + extra_headers=extra_headers, |
| 4934 | + extra_body=extra_body, |
| 4935 | + timeout=timeout, |
| 4936 | + ) |
| 4937 | + |
| 4938 | + async def convert_urls_to_pdf( |
| 4939 | + self, |
| 4940 | + urls: UrlInput, |
| 4941 | + *, |
| 4942 | + output: str | None = None, |
| 4943 | + compression: PdfConversionCompression | None = None, |
| 4944 | + downsample: PdfConversionDownsample | None = None, |
| 4945 | + page_size: HtmlPageSize | None = None, |
| 4946 | + page_margin: str | None = None, |
| 4947 | + page_orientation: HtmlPageOrientation | None = None, |
| 4948 | + web_layout: HtmlWebLayout | None = None, |
| 4949 | + extra_query: Query | None = None, |
| 4950 | + extra_headers: AnyMapping | None = None, |
| 4951 | + extra_body: Body | None = None, |
| 4952 | + timeout: TimeoutTypes | None = None, |
| 4953 | + ) -> PdfRestFileBasedResponse: |
| 4954 | + """Asynchronously convert HTML content from one or more URLs to PDF.""" |
| 4955 | + |
| 4956 | + payload: dict[str, Any] = {"url": urls} |
| 4957 | + if output is not None: |
| 4958 | + payload["output"] = output |
| 4959 | + if compression is not None: |
| 4960 | + payload["compression"] = compression |
| 4961 | + if downsample is not None: |
| 4962 | + payload["downsample"] = downsample |
| 4963 | + if page_size is not None: |
| 4964 | + payload["page_size"] = page_size |
| 4965 | + if page_margin is not None: |
| 4966 | + payload["page_margin"] = page_margin |
| 4967 | + if page_orientation is not None: |
| 4968 | + payload["page_orientation"] = page_orientation |
| 4969 | + if web_layout is not None: |
| 4970 | + payload["web_layout"] = web_layout |
| 4971 | + |
| 4972 | + return await self._post_file_operation( |
| 4973 | + endpoint="/pdf", |
| 4974 | + payload=payload, |
| 4975 | + payload_model=ConvertUrlsToPdfPayload, |
| 4976 | + extra_query=extra_query, |
| 4977 | + extra_headers=extra_headers, |
| 4978 | + extra_body=extra_body, |
| 4979 | + timeout=timeout, |
| 4980 | + ) |
| 4981 | + |
4786 | 4982 | async def convert_to_pdfa( |
4787 | 4983 | self, |
4788 | 4984 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments