from ironpdf import * import concurrent.futures import uuid # Instantiate Renderer renderer = ChromePdfRenderer() htmlStrings = ["<h1>Html#1</h1>", "<h1>Html#2</h1>", "<h1>Html#3</h1>"] with concurrent.futures.ThreadPoolExecutor() as executor: futures = [] for html in htmlStrings: futures.append(executor.submit(renderer.RenderHtmlAsPdf, html)) # do something with each pdfDocument for future in concurrent.futures.as_completed(futures): pdf = future.result() pdf.SaveAs(f"{uuid.uuid4()}.pdf") # do something with each pdf
並行 PDF 生成