from ironpdf import * # Instantiate Renderer renderer = ChromePdfRenderer() # Either load your RTF file directly pdf_from_rtf_file = renderer.RenderRtfFileAsPdf("/files/doc.rtf") # Or instead, load it as a string pdf_from_rtf_string = renderer.RenderRtfStringAsPdf(r"{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl;\red0\green0\blue0;}\cf0This is some \b bold \b0 and \i italic \i0 text.}") # Save your PDF pdf_from_rtf_file.SaveAs("pdf_from_rtf_file.pdf") pdf_from_rtf_string.SaveAs("pdf_from_rtf_string.pdf")
RTF 转 PDF