@@ -133,13 +133,15 @@ def check_resources(self, dtable_uuid, plugin_type, page_id, doc_uuid, table_id,
133133 'row_ids' : row_ids
134134 }, None
135135
136- async def row_page_to_pdf (self , url , context , row_id , action_type , per_converted_callbacks ):
136+ async def row_page_to_pdf (self , url , context , row_id , plugin_type , action_type , per_converted_callbacks ):
137137 page = await context .new_page ()
138138 page .on ("request" , lambda request : logger .debug (f"Request: { request .method } { request .url } " ))
139139 page .on ("response" , lambda response : logger .debug (f"Response: { response .status } { response .url } " ))
140140 page .on ("console" , lambda msg : logger .debug (f"Console [{ msg .type } ]: { msg .text } " ))
141141 try :
142142 await page .goto (url , wait_until = "load" )
143+ if plugin_type == 'page-design' :
144+ await page .wait_for_selector ('#page-design-render-complete' , state = "attached" , timeout = 60 * 1000 )
143145 await wait_for_images (page )
144146 content = await page .pdf (** get_pdf_print_options ())
145147 except TimeoutError :
@@ -194,7 +196,7 @@ async def convert_with_rows(self, task_info, resources):
194196 continue
195197 url += '?access-token=%s&need_convert=%s' % (dtable_server_api .internal_access_token , 0 )
196198
197- tasks .append (self .row_page_to_pdf (url , context , row_id , action_type , per_converted_callbacks ))
199+ tasks .append (self .row_page_to_pdf (url , context , row_id , plugin_type , action_type , per_converted_callbacks ))
198200
199201 results = await asyncio .gather (* tasks , return_exceptions = True )
200202 for result in results :
@@ -244,7 +246,8 @@ async def convert_without_rows(self, task_info):
244246 try :
245247 await page .goto (url , wait_until = "load" )
246248 await page .wait_for_load_state ('networkidle' , timeout = 180 * 1000 )
247- await page .wait_for_selector ('#document-render-complete' , timeout = 60 * 1000 )
249+ if plugin_type == 'document' :
250+ await page .wait_for_selector ('#document-render-complete' , state = 'attached' , timeout = 60 * 1000 )
248251 await wait_for_images (page )
249252 pdf_content = await page .pdf (** get_pdf_print_options ())
250253 except TimeoutError :
0 commit comments