|
76 | 76 | BasePdfRestGraphicPayload, |
77 | 77 | BmpPdfRestPayload, |
78 | 78 | ConvertToMarkdownPayload, |
| 79 | + ConvertToPdfPayload, |
| 80 | + ConvertUrlsToPdfPayload, |
79 | 81 | DeletePayload, |
80 | 82 | ExtractImagesPayload, |
81 | 83 | ExtractTextPayload, |
|
121 | 123 | FlattenQuality, |
122 | 124 | GifColorModel, |
123 | 125 | GraphicSmoothing, |
| 126 | + HtmlPageOrientation, |
| 127 | + HtmlPageSize, |
| 128 | + HtmlWebLayout, |
124 | 129 | JpegColorModel, |
125 | 130 | OcrLanguage, |
126 | 131 | PdfAddTextObject, |
127 | 132 | PdfAType, |
| 133 | + PdfConversionCompression, |
| 134 | + PdfConversionDownsample, |
| 135 | + PdfConversionLocale, |
128 | 136 | PdfInfoQuery, |
129 | 137 | PdfMergeInput, |
130 | 138 | PdfPageSelection, |
@@ -3175,6 +3183,100 @@ def rasterize_pdf( |
3175 | 3183 | timeout=timeout, |
3176 | 3184 | ) |
3177 | 3185 |
|
| 3186 | + def convert_to_pdf( |
| 3187 | + self, |
| 3188 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 3189 | + *, |
| 3190 | + output: str | None = None, |
| 3191 | + compression: PdfConversionCompression | None = None, |
| 3192 | + downsample: PdfConversionDownsample | None = None, |
| 3193 | + tagged_pdf: bool | None = None, |
| 3194 | + locale: PdfConversionLocale | None = None, |
| 3195 | + page_size: HtmlPageSize | None = None, |
| 3196 | + page_margin: str | None = None, |
| 3197 | + page_orientation: HtmlPageOrientation | None = None, |
| 3198 | + web_layout: HtmlWebLayout | None = None, |
| 3199 | + extra_query: Query | None = None, |
| 3200 | + extra_headers: AnyMapping | None = None, |
| 3201 | + extra_body: Body | None = None, |
| 3202 | + timeout: TimeoutTypes | None = None, |
| 3203 | + ) -> PdfRestFileBasedResponse: |
| 3204 | + """Convert a supported file type to PDF.""" |
| 3205 | + |
| 3206 | + payload: dict[str, Any] = {"files": file} |
| 3207 | + if output is not None: |
| 3208 | + payload["output"] = output |
| 3209 | + if compression is not None: |
| 3210 | + payload["compression"] = compression |
| 3211 | + if downsample is not None: |
| 3212 | + payload["downsample"] = downsample |
| 3213 | + if tagged_pdf is not None: |
| 3214 | + payload["tagged_pdf"] = tagged_pdf |
| 3215 | + if locale is not None: |
| 3216 | + payload["locale"] = locale |
| 3217 | + if page_size is not None: |
| 3218 | + payload["page_size"] = page_size |
| 3219 | + if page_margin is not None: |
| 3220 | + payload["page_margin"] = page_margin |
| 3221 | + if page_orientation is not None: |
| 3222 | + payload["page_orientation"] = page_orientation |
| 3223 | + if web_layout is not None: |
| 3224 | + payload["web_layout"] = web_layout |
| 3225 | + |
| 3226 | + return self._post_file_operation( |
| 3227 | + endpoint="/pdf", |
| 3228 | + payload=payload, |
| 3229 | + payload_model=ConvertToPdfPayload, |
| 3230 | + extra_query=extra_query, |
| 3231 | + extra_headers=extra_headers, |
| 3232 | + extra_body=extra_body, |
| 3233 | + timeout=timeout, |
| 3234 | + ) |
| 3235 | + |
| 3236 | + def convert_urls_to_pdf( |
| 3237 | + self, |
| 3238 | + urls: UrlInput, |
| 3239 | + *, |
| 3240 | + output: str | None = None, |
| 3241 | + compression: PdfConversionCompression | None = None, |
| 3242 | + downsample: PdfConversionDownsample | None = None, |
| 3243 | + page_size: HtmlPageSize | None = None, |
| 3244 | + page_margin: str | None = None, |
| 3245 | + page_orientation: HtmlPageOrientation | None = None, |
| 3246 | + web_layout: HtmlWebLayout | None = None, |
| 3247 | + extra_query: Query | None = None, |
| 3248 | + extra_headers: AnyMapping | None = None, |
| 3249 | + extra_body: Body | None = None, |
| 3250 | + timeout: TimeoutTypes | None = None, |
| 3251 | + ) -> PdfRestFileBasedResponse: |
| 3252 | + """Convert HTML content from one or more URLs to PDF.""" |
| 3253 | + |
| 3254 | + payload: dict[str, Any] = {"url": urls} |
| 3255 | + if output is not None: |
| 3256 | + payload["output"] = output |
| 3257 | + if compression is not None: |
| 3258 | + payload["compression"] = compression |
| 3259 | + if downsample is not None: |
| 3260 | + payload["downsample"] = downsample |
| 3261 | + if page_size is not None: |
| 3262 | + payload["page_size"] = page_size |
| 3263 | + if page_margin is not None: |
| 3264 | + payload["page_margin"] = page_margin |
| 3265 | + if page_orientation is not None: |
| 3266 | + payload["page_orientation"] = page_orientation |
| 3267 | + if web_layout is not None: |
| 3268 | + payload["web_layout"] = web_layout |
| 3269 | + |
| 3270 | + return self._post_file_operation( |
| 3271 | + endpoint="/pdf", |
| 3272 | + payload=payload, |
| 3273 | + payload_model=ConvertUrlsToPdfPayload, |
| 3274 | + extra_query=extra_query, |
| 3275 | + extra_headers=extra_headers, |
| 3276 | + extra_body=extra_body, |
| 3277 | + timeout=timeout, |
| 3278 | + ) |
| 3279 | + |
3178 | 3280 | def convert_to_pdfa( |
3179 | 3281 | self, |
3180 | 3282 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -4555,6 +4657,100 @@ async def rasterize_pdf( |
4555 | 4657 | timeout=timeout, |
4556 | 4658 | ) |
4557 | 4659 |
|
| 4660 | + async def convert_to_pdf( |
| 4661 | + self, |
| 4662 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 4663 | + *, |
| 4664 | + output: str | None = None, |
| 4665 | + compression: PdfConversionCompression | None = None, |
| 4666 | + downsample: PdfConversionDownsample | None = None, |
| 4667 | + tagged_pdf: bool | None = None, |
| 4668 | + locale: PdfConversionLocale | None = None, |
| 4669 | + page_size: HtmlPageSize | None = None, |
| 4670 | + page_margin: str | None = None, |
| 4671 | + page_orientation: HtmlPageOrientation | None = None, |
| 4672 | + web_layout: HtmlWebLayout | None = None, |
| 4673 | + extra_query: Query | None = None, |
| 4674 | + extra_headers: AnyMapping | None = None, |
| 4675 | + extra_body: Body | None = None, |
| 4676 | + timeout: TimeoutTypes | None = None, |
| 4677 | + ) -> PdfRestFileBasedResponse: |
| 4678 | + """Asynchronously convert a supported file type to PDF.""" |
| 4679 | + |
| 4680 | + payload: dict[str, Any] = {"files": file} |
| 4681 | + if output is not None: |
| 4682 | + payload["output"] = output |
| 4683 | + if compression is not None: |
| 4684 | + payload["compression"] = compression |
| 4685 | + if downsample is not None: |
| 4686 | + payload["downsample"] = downsample |
| 4687 | + if tagged_pdf is not None: |
| 4688 | + payload["tagged_pdf"] = tagged_pdf |
| 4689 | + if locale is not None: |
| 4690 | + payload["locale"] = locale |
| 4691 | + if page_size is not None: |
| 4692 | + payload["page_size"] = page_size |
| 4693 | + if page_margin is not None: |
| 4694 | + payload["page_margin"] = page_margin |
| 4695 | + if page_orientation is not None: |
| 4696 | + payload["page_orientation"] = page_orientation |
| 4697 | + if web_layout is not None: |
| 4698 | + payload["web_layout"] = web_layout |
| 4699 | + |
| 4700 | + return await self._post_file_operation( |
| 4701 | + endpoint="/pdf", |
| 4702 | + payload=payload, |
| 4703 | + payload_model=ConvertToPdfPayload, |
| 4704 | + extra_query=extra_query, |
| 4705 | + extra_headers=extra_headers, |
| 4706 | + extra_body=extra_body, |
| 4707 | + timeout=timeout, |
| 4708 | + ) |
| 4709 | + |
| 4710 | + async def convert_urls_to_pdf( |
| 4711 | + self, |
| 4712 | + urls: UrlInput, |
| 4713 | + *, |
| 4714 | + output: str | None = None, |
| 4715 | + compression: PdfConversionCompression | None = None, |
| 4716 | + downsample: PdfConversionDownsample | None = None, |
| 4717 | + page_size: HtmlPageSize | None = None, |
| 4718 | + page_margin: str | None = None, |
| 4719 | + page_orientation: HtmlPageOrientation | None = None, |
| 4720 | + web_layout: HtmlWebLayout | None = None, |
| 4721 | + extra_query: Query | None = None, |
| 4722 | + extra_headers: AnyMapping | None = None, |
| 4723 | + extra_body: Body | None = None, |
| 4724 | + timeout: TimeoutTypes | None = None, |
| 4725 | + ) -> PdfRestFileBasedResponse: |
| 4726 | + """Asynchronously convert HTML content from one or more URLs to PDF.""" |
| 4727 | + |
| 4728 | + payload: dict[str, Any] = {"url": urls} |
| 4729 | + if output is not None: |
| 4730 | + payload["output"] = output |
| 4731 | + if compression is not None: |
| 4732 | + payload["compression"] = compression |
| 4733 | + if downsample is not None: |
| 4734 | + payload["downsample"] = downsample |
| 4735 | + if page_size is not None: |
| 4736 | + payload["page_size"] = page_size |
| 4737 | + if page_margin is not None: |
| 4738 | + payload["page_margin"] = page_margin |
| 4739 | + if page_orientation is not None: |
| 4740 | + payload["page_orientation"] = page_orientation |
| 4741 | + if web_layout is not None: |
| 4742 | + payload["web_layout"] = web_layout |
| 4743 | + |
| 4744 | + return await self._post_file_operation( |
| 4745 | + endpoint="/pdf", |
| 4746 | + payload=payload, |
| 4747 | + payload_model=ConvertUrlsToPdfPayload, |
| 4748 | + extra_query=extra_query, |
| 4749 | + extra_headers=extra_headers, |
| 4750 | + extra_body=extra_body, |
| 4751 | + timeout=timeout, |
| 4752 | + ) |
| 4753 | + |
4558 | 4754 | async def convert_to_pdfa( |
4559 | 4755 | self, |
4560 | 4756 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments