设置为灰度
将彩色PDF文档转换为灰度可以提供几个优势,例如去除颜色的考虑,仅专注于颜色强度。
只在使用IronPDF 的 HTML 转 PDF 转换功能时才能生成灰度 PDF。 您可以应用包含grayScale属性的渲染选项,该属性可以设置为true或false。 将此属性设置为true将生成灰度 PDF,而不是彩色 PDF。
import {PdfDocument} from "@ironsoftware/ironpdf";
(async () => {
// Configure render options
const renderOptions = {
// Set color to grayscale
grayScale: true,
};
const pdf = await PdfDocument.fromHtml("my-content.html", { renderOptions });
// Export the PDF document
await pdf.saveAs("my-content.pdf");
})();将彩色PDF文档转换为灰度可以提供几个优势,例如去除颜色的考虑,仅专注于颜色强度。
只在使用IronPDF 的 HTML 转 PDF 转换功能时才能生成灰度 PDF。 您可以应用包含grayScale属性的渲染选项,该属性可以设置为true或false。 将此属性设置为true将生成灰度 PDF,而不是彩色 PDF。