Establecer Márgenes IronPDF creates new PDF documents with 25-millimeter margins (top, bottom, left, and right) by default. However, IronPDF allows developers to set custom measurements for each margin as needed to achieve specific design criteria. Developers can define custom margins for new PDFs using ChromePdfRenderOptions. The featured code example sets custom values for all four margins: 20-millimeter left and right margins and 40-millimeter top and bottom margins. Specify PDF margins suitable for any document type: letters, posters, postcards, etc.--or create borderless documents suitable for commercial printing by setting each margin to zero millimeters. Use ChromePdfRenderOptions objects with PDF rendering methods (renderUrlAsPdf, renderHtmlAsPdf, and renderHtmlFileAsPdf) to define additional print-specific options apart from margin sizes, such as paper size, DPI, headers and footers, and others. View more information about available customization options in the ChromePdfRenderOptions API Reference. In this code: We instantiate ChromePdfRenderOptions to set custom margins for the PDF. The margins are set in millimeters. We use an instance of ChromePdfRenderer, a class provided by IronPDF, to apply the rendering options. The RenderHtmlAsPdf method is called with a simple HTML string to demonstrate rendering a PDF with the specified margins. Finally, the rendered PDF is saved to a file named "output.pdf". Explore ChromePdfRenderOptions API for Custom PDF Margins Enlaces de Documentos Ver en Github Tutorial Relacionado Guía de Cómo Hacer Relacionada Documentación de Clase Obtener Paquetes de Idiomas Descargar IronPDF DLL Reportar un problema en esta página ¿Listo para empezar? Versión: 2025.11 recién lanzado Descarga Gratis de Maven Ver Licencias
Producto completamente funcional Obtén 30 días de producto completamente funcional.Instálalo y ejecútalo en minutos.
Soporte técnico 24/5 Acceso completo a nuestro equipo de soporte técnico durante tu prueba del producto
Producto completamente funcional Obtén 30 días de producto completamente funcional.Instálalo y ejecútalo en minutos.
Soporte técnico 24/5 Acceso completo a nuestro equipo de soporte técnico durante tu prueba del producto