@@ -51,6 +51,8 @@ def _serialize_text_object_for_request(
5151 cmyk = serialized .get ("text_color_cmyk" )
5252 if isinstance (cmyk , (list , tuple )):
5353 serialized ["text_color_cmyk" ] = "," .join (str (channel ) for channel in cmyk )
54+ if "is_right_to_left" in serialized :
55+ serialized ["is_rtl" ] = serialized .pop ("is_right_to_left" )
5456 # Add-text payloads now quote non-string values inside the text_objects JSON.
5557 for key , value in list (serialized .items ()):
5658 if not isinstance (value , str ):
@@ -72,7 +74,11 @@ def handler(request: httpx.Request) -> httpx.Response:
7274 assert payload ["id" ] == str (pdf_file .id )
7375 assert payload ["output" ] == "with-text"
7476 assert payload ["text_objects" ] == json .dumps (
75- [_serialize_text_object_for_request (make_text_object ())],
77+ [
78+ _serialize_text_object_for_request (
79+ make_text_object (is_right_to_left = True )
80+ )
81+ ],
7682 separators = ("," , ":" ),
7783 )
7884 return httpx .Response (
@@ -99,7 +105,7 @@ def handler(request: httpx.Request) -> httpx.Response:
99105 with PdfRestClient (api_key = VALID_API_KEY , transport = transport ) as client :
100106 response = client .add_text_to_pdf (
101107 pdf_file ,
102- text_objects = [make_text_object ()],
108+ text_objects = [make_text_object (is_right_to_left = True )],
103109 output = "with-text" ,
104110 )
105111
@@ -283,7 +289,11 @@ def handler(request: httpx.Request) -> httpx.Response:
283289 payload = json .loads (request .content .decode ("utf-8" ))
284290 assert payload ["id" ] == str (pdf_file .id )
285291 assert payload ["text_objects" ] == json .dumps (
286- [_serialize_text_object_for_request (make_text_object (page = "all" ))],
292+ [
293+ _serialize_text_object_for_request (
294+ make_text_object (page = "all" , is_right_to_left = True )
295+ )
296+ ],
287297 separators = ("," , ":" ),
288298 )
289299 return httpx .Response (
@@ -310,7 +320,7 @@ def handler(request: httpx.Request) -> httpx.Response:
310320 async with AsyncPdfRestClient (api_key = ASYNC_API_KEY , transport = transport ) as client :
311321 response = await client .add_text_to_pdf (
312322 pdf_file ,
313- text_objects = [make_text_object (page = "all" )],
323+ text_objects = [make_text_object (page = "all" , is_right_to_left = True )],
314324 )
315325
316326 assert seen == {"post" : 1 , "get" : 1 }
0 commit comments