@@ -3110,25 +3110,19 @@ def convert_office_to_pdf(
31103110 ) -> PdfRestFileBasedResponse :
31113111 """Convert a Microsoft Office file (Word, Excel, PowerPoint) to PDF."""
31123112
3113- payload : dict [str , Any ] = {"files" : file }
3114- if output is not None :
3115- payload ["output" ] = output
3116- if compression is not None :
3117- payload ["compression" ] = compression
3118- if downsample is not None :
3119- payload ["downsample" ] = downsample
3120- if tagged_pdf is not None :
3121- payload ["tagged_pdf" ] = tagged_pdf
3122- if locale is not None :
3123- payload ["locale" ] = locale
3124- if page_size is not None :
3125- payload ["page_size" ] = page_size
3126- if page_margin is not None :
3127- payload ["page_margin" ] = page_margin
3128- if page_orientation is not None :
3129- payload ["page_orientation" ] = page_orientation
3130- if web_layout is not None :
3131- payload ["web_layout" ] = web_layout
3113+ payload : dict [str , Any ] = {
3114+ "files" : file ,
3115+ "output" : output ,
3116+ "compression" : compression ,
3117+ "downsample" : downsample ,
3118+ "tagged_pdf" : tagged_pdf ,
3119+ "locale" : locale ,
3120+ "page_size" : page_size ,
3121+ "page_margin" : page_margin ,
3122+ "page_orientation" : page_orientation ,
3123+ "web_layout" : web_layout ,
3124+ }
3125+ payload = {key : value for key , value in payload .items () if value is not None }
31323126
31333127 return self ._post_file_operation (
31343128 endpoint = "/pdf" ,
@@ -3154,13 +3148,13 @@ def convert_postscript_to_pdf(
31543148 ) -> PdfRestFileBasedResponse :
31553149 """Convert a PostScript or EPS file to PDF."""
31563150
3157- payload : dict [str , Any ] = {"files" : file }
3158- if output is not None :
3159- payload [ "output" ] = output
3160- if compression is not None :
3161- payload [ "compression" ] = compression
3162- if downsample is not None :
3163- payload [ "downsample" ] = downsample
3151+ payload : dict [str , Any ] = {
3152+ "files" : file ,
3153+ "output" : output ,
3154+ "compression" : compression ,
3155+ "downsample" : downsample ,
3156+ }
3157+ payload = { key : value for key , value in payload . items () if value is not None }
31643158
31653159 return self ._post_file_operation (
31663160 endpoint = "/pdf" ,
@@ -3184,9 +3178,11 @@ def convert_email_to_pdf(
31843178 ) -> PdfRestFileBasedResponse :
31853179 """Convert an RFC822 email file to PDF."""
31863180
3187- payload : dict [str , Any ] = {"files" : file }
3188- if output is not None :
3189- payload ["output" ] = output
3181+ payload : dict [str , Any ] = {
3182+ "files" : file ,
3183+ "output" : output ,
3184+ }
3185+ payload = {key : value for key , value in payload .items () if value is not None }
31903186
31913187 return self ._post_file_operation (
31923188 endpoint = "/pdf" ,
@@ -3210,9 +3206,11 @@ def convert_image_to_pdf(
32103206 ) -> PdfRestFileBasedResponse :
32113207 """Convert a supported image file to PDF."""
32123208
3213- payload : dict [str , Any ] = {"files" : file }
3214- if output is not None :
3215- payload ["output" ] = output
3209+ payload : dict [str , Any ] = {
3210+ "files" : file ,
3211+ "output" : output ,
3212+ }
3213+ payload = {key : value for key , value in payload .items () if value is not None }
32163214
32173215 return self ._post_file_operation (
32183216 endpoint = "/pdf" ,
@@ -3242,21 +3240,17 @@ def convert_html_to_pdf(
32423240 ) -> PdfRestFileBasedResponse :
32433241 """Convert an uploaded HTML file to PDF."""
32443242
3245- payload : dict [str , Any ] = {"files" : file }
3246- if output is not None :
3247- payload ["output" ] = output
3248- if compression is not None :
3249- payload ["compression" ] = compression
3250- if downsample is not None :
3251- payload ["downsample" ] = downsample
3252- if page_size is not None :
3253- payload ["page_size" ] = page_size
3254- if page_margin is not None :
3255- payload ["page_margin" ] = page_margin
3256- if page_orientation is not None :
3257- payload ["page_orientation" ] = page_orientation
3258- if web_layout is not None :
3259- payload ["web_layout" ] = web_layout
3243+ payload : dict [str , Any ] = {
3244+ "files" : file ,
3245+ "output" : output ,
3246+ "compression" : compression ,
3247+ "downsample" : downsample ,
3248+ "page_size" : page_size ,
3249+ "page_margin" : page_margin ,
3250+ "page_orientation" : page_orientation ,
3251+ "web_layout" : web_layout ,
3252+ }
3253+ payload = {key : value for key , value in payload .items () if value is not None }
32603254
32613255 return self ._post_file_operation (
32623256 endpoint = "/pdf" ,
@@ -3286,21 +3280,17 @@ def convert_urls_to_pdf(
32863280 ) -> PdfRestFileBasedResponse :
32873281 """Convert HTML content from one or more URLs to PDF."""
32883282
3289- payload : dict [str , Any ] = {"url" : urls }
3290- if output is not None :
3291- payload ["output" ] = output
3292- if compression is not None :
3293- payload ["compression" ] = compression
3294- if downsample is not None :
3295- payload ["downsample" ] = downsample
3296- if page_size is not None :
3297- payload ["page_size" ] = page_size
3298- if page_margin is not None :
3299- payload ["page_margin" ] = page_margin
3300- if page_orientation is not None :
3301- payload ["page_orientation" ] = page_orientation
3302- if web_layout is not None :
3303- payload ["web_layout" ] = web_layout
3283+ payload : dict [str , Any ] = {
3284+ "url" : urls ,
3285+ "output" : output ,
3286+ "compression" : compression ,
3287+ "downsample" : downsample ,
3288+ "page_size" : page_size ,
3289+ "page_margin" : page_margin ,
3290+ "page_orientation" : page_orientation ,
3291+ "web_layout" : web_layout ,
3292+ }
3293+ payload = {key : value for key , value in payload .items () if value is not None }
33043294
33053295 return self ._post_file_operation (
33063296 endpoint = "/pdf" ,
@@ -4619,25 +4609,19 @@ async def convert_office_to_pdf(
46194609 ) -> PdfRestFileBasedResponse :
46204610 """Asynchronously convert a Microsoft Office file to PDF."""
46214611
4622- payload : dict [str , Any ] = {"files" : file }
4623- if output is not None :
4624- payload ["output" ] = output
4625- if compression is not None :
4626- payload ["compression" ] = compression
4627- if downsample is not None :
4628- payload ["downsample" ] = downsample
4629- if tagged_pdf is not None :
4630- payload ["tagged_pdf" ] = tagged_pdf
4631- if locale is not None :
4632- payload ["locale" ] = locale
4633- if page_size is not None :
4634- payload ["page_size" ] = page_size
4635- if page_margin is not None :
4636- payload ["page_margin" ] = page_margin
4637- if page_orientation is not None :
4638- payload ["page_orientation" ] = page_orientation
4639- if web_layout is not None :
4640- payload ["web_layout" ] = web_layout
4612+ payload : dict [str , Any ] = {
4613+ "files" : file ,
4614+ "output" : output ,
4615+ "compression" : compression ,
4616+ "downsample" : downsample ,
4617+ "tagged_pdf" : tagged_pdf ,
4618+ "locale" : locale ,
4619+ "page_size" : page_size ,
4620+ "page_margin" : page_margin ,
4621+ "page_orientation" : page_orientation ,
4622+ "web_layout" : web_layout ,
4623+ }
4624+ payload = {key : value for key , value in payload .items () if value is not None }
46414625
46424626 return await self ._post_file_operation (
46434627 endpoint = "/pdf" ,
@@ -4663,13 +4647,13 @@ async def convert_postscript_to_pdf(
46634647 ) -> PdfRestFileBasedResponse :
46644648 """Asynchronously convert a PostScript or EPS file to PDF."""
46654649
4666- payload : dict [str , Any ] = {"files" : file }
4667- if output is not None :
4668- payload [ "output" ] = output
4669- if compression is not None :
4670- payload [ "compression" ] = compression
4671- if downsample is not None :
4672- payload [ "downsample" ] = downsample
4650+ payload : dict [str , Any ] = {
4651+ "files" : file ,
4652+ "output" : output ,
4653+ "compression" : compression ,
4654+ "downsample" : downsample ,
4655+ }
4656+ payload = { key : value for key , value in payload . items () if value is not None }
46734657
46744658 return await self ._post_file_operation (
46754659 endpoint = "/pdf" ,
@@ -4693,9 +4677,11 @@ async def convert_email_to_pdf(
46934677 ) -> PdfRestFileBasedResponse :
46944678 """Asynchronously convert an RFC822 email file to PDF."""
46954679
4696- payload : dict [str , Any ] = {"files" : file }
4697- if output is not None :
4698- payload ["output" ] = output
4680+ payload : dict [str , Any ] = {
4681+ "files" : file ,
4682+ "output" : output ,
4683+ }
4684+ payload = {key : value for key , value in payload .items () if value is not None }
46994685
47004686 return await self ._post_file_operation (
47014687 endpoint = "/pdf" ,
@@ -4719,9 +4705,11 @@ async def convert_image_to_pdf(
47194705 ) -> PdfRestFileBasedResponse :
47204706 """Asynchronously convert a supported image file to PDF."""
47214707
4722- payload : dict [str , Any ] = {"files" : file }
4723- if output is not None :
4724- payload ["output" ] = output
4708+ payload : dict [str , Any ] = {
4709+ "files" : file ,
4710+ "output" : output ,
4711+ }
4712+ payload = {key : value for key , value in payload .items () if value is not None }
47254713
47264714 return await self ._post_file_operation (
47274715 endpoint = "/pdf" ,
@@ -4751,21 +4739,17 @@ async def convert_html_to_pdf(
47514739 ) -> PdfRestFileBasedResponse :
47524740 """Asynchronously convert an uploaded HTML file to PDF."""
47534741
4754- payload : dict [str , Any ] = {"files" : file }
4755- if output is not None :
4756- payload ["output" ] = output
4757- if compression is not None :
4758- payload ["compression" ] = compression
4759- if downsample is not None :
4760- payload ["downsample" ] = downsample
4761- if page_size is not None :
4762- payload ["page_size" ] = page_size
4763- if page_margin is not None :
4764- payload ["page_margin" ] = page_margin
4765- if page_orientation is not None :
4766- payload ["page_orientation" ] = page_orientation
4767- if web_layout is not None :
4768- payload ["web_layout" ] = web_layout
4742+ payload : dict [str , Any ] = {
4743+ "files" : file ,
4744+ "output" : output ,
4745+ "compression" : compression ,
4746+ "downsample" : downsample ,
4747+ "page_size" : page_size ,
4748+ "page_margin" : page_margin ,
4749+ "page_orientation" : page_orientation ,
4750+ "web_layout" : web_layout ,
4751+ }
4752+ payload = {key : value for key , value in payload .items () if value is not None }
47694753
47704754 return await self ._post_file_operation (
47714755 endpoint = "/pdf" ,
@@ -4795,21 +4779,17 @@ async def convert_urls_to_pdf(
47954779 ) -> PdfRestFileBasedResponse :
47964780 """Asynchronously convert HTML content from one or more URLs to PDF."""
47974781
4798- payload : dict [str , Any ] = {"url" : urls }
4799- if output is not None :
4800- payload ["output" ] = output
4801- if compression is not None :
4802- payload ["compression" ] = compression
4803- if downsample is not None :
4804- payload ["downsample" ] = downsample
4805- if page_size is not None :
4806- payload ["page_size" ] = page_size
4807- if page_margin is not None :
4808- payload ["page_margin" ] = page_margin
4809- if page_orientation is not None :
4810- payload ["page_orientation" ] = page_orientation
4811- if web_layout is not None :
4812- payload ["web_layout" ] = web_layout
4782+ payload : dict [str , Any ] = {
4783+ "url" : urls ,
4784+ "output" : output ,
4785+ "compression" : compression ,
4786+ "downsample" : downsample ,
4787+ "page_size" : page_size ,
4788+ "page_margin" : page_margin ,
4789+ "page_orientation" : page_orientation ,
4790+ "web_layout" : web_layout ,
4791+ }
4792+ payload = {key : value for key , value in payload .items () if value is not None }
48134793
48144794 return await self ._post_file_operation (
48154795 endpoint = "/pdf" ,
0 commit comments