from ironpdf import * # Instantiate Renderer renderer = ChromePdfRenderer() # Choose Screen or Print CSS media renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Screen # Set the width of the responsive virtual browser window in pixels renderer.RenderingOptions.ViewPortWidth = 1920 # Set paper mode to automatic fit to physical paper renderer.RenderingOptions.FitToPaperMode = FitToPaperModes.AutomaticFit # Render an HTML file pdf = renderer.RenderHtmlFileAsPdf("Responsive.html")
响应式HTML转PDF