Class PdfSaveOptions

Class PdfSaveOptions

名称: Aspose.Cells 收集: Aspose.Cells.dll (25.4.0)

代表保存PDF文件的选项。

public class PdfSaveOptions : PaginatedSaveOptions

Inheritance

object SaveOptions PaginatedSaveOptions PdfSaveOptions

Constructors

PdfSaveOptions()

创建保存PDF文件的选项。

public PdfSaveOptions()

Properties

Bookmark

获取并设置 Aspose.Cells.Rendering.PdfBookmarkEntry?text=PdfBookmarkEntry 对象。

public PdfBookmarkEntry Bookmark { get; set; }

财产价值

PdfBookmarkEntry

CalculateFormula

表明在保存PDF文件之前是否要计算公式。

public bool CalculateFormula { get; set; }

财产价值

bool

Remarks

默认值是虚假的。

Compliance

获取或设置出发文件的 PDF 标准遵守水平。

public PdfCompliance Compliance { get; set; }

财产价值

PdfCompliance

Remarks

此分類上一篇: PDF17

CreatedTime

获取并设置创建PDF文档的时间。

public DateTime CreatedTime { get; set; }

财产价值

DateTime

Remarks

如果它没有设置,现在是时候创建PDF。

CustomPropertiesExport

获取或设置一个值,确定如何 Aspose.Cells.Properties.CustomDocumentPropertyCollection 出口到 PDF 文件。

public PdfCustomPropertiesExport CustomPropertiesExport { get; set; }

财产价值

PdfCustomPropertiesExport

DisplayDocTitle

表示窗口的标题栏是否应该显示文档标题。

public bool DisplayDocTitle { get; set; }

财产价值

bool

Remarks

如果是虚假的,则标题栏应显示 PDF 文件的名称。假值是假的。

EmbedAttachments

表示是否在 Excel 中插入 Ole 对象的附件。

public bool EmbedAttachments { get; set; }

财产价值

bool

Remarks

默认值是虚假的,当 PDF/A 符合性设置或 PDF 加密启用时,该值必须是虚假的。

EmbedStandardWindowsFonts

真正的字体,真正的字体。只影响 ASCII 字符 32-127.字体代码大于127的字体总是嵌入。字体始终为 PDF/A-1a、PDF/A-1b 标准。假设是真实的。

public bool EmbedStandardWindowsFonts { get; set; }

财产价值

bool

ExportDocumentStructure

指示是否出口文件结构。

public bool ExportDocumentStructure { get; set; }

财产价值

bool

FontEncoding

收到或设置嵌入式字体编码在PDF。

public PdfFontEncoding FontEncoding { get; set; }

财产价值

PdfFontEncoding

Remarks

默认值是 Aspose.Cells.Rendering.PdfFontEncoding.Identity

ImageType

代表图像类型在转换图表和形状时。

[Obsolete("Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality.")]
[Browsable(false)]
public ImageType ImageType { get; set; }

财产价值

ImageType

Remarks

注意:这个成员现在已经过时了。图表和形状始终以 vector 元素(例如点、线)为提供质量。该财产将于2022年6月12日以后撤销。阿斯波斯对您可能遇到的任何不适表示道歉。

OptimizationType

获取和设置PDF优化类型。

public PdfOptimizationType OptimizationType { get; set; }

财产价值

PdfOptimizationType

Remarks

默认值是 Aspose.Cells.Rendering.PdfOptimizationType.Standard

PdfCompression

指示压缩算法

public PdfCompressionCore PdfCompression { get; set; }

财产价值

PdfCompressionCore

Producer

获取和设置创建的PDF文档的制作人。

public string Producer { get; set; }

财产价值

string

Remarks

如果值为零,或者未设置有效许可证,则将使用 Aspose.Cells vVERSION 行。

SecurityOptions

在 xls2pdf 结果中设置此选项时需要安全性。

public PdfSecurityOptions SecurityOptions { get; set; }

财产价值

PdfSecurityOptions

Examples

下面的代码设置了高分辨率打印许可,以便输出PDF。

Workbook wb = new Workbook();
wb.Worksheets[0].Cells["A1"].Value = "Aspose";

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();


PdfSecurityOptions pdfSecurityOptions = new PdfSecurityOptions();

//set owner password
pdfSecurityOptions.OwnerPassword = "YourOwnerPassword";

//set user password
pdfSecurityOptions.UserPassword = "YourUserPassword";

//set print permisson
pdfSecurityOptions.PrintPermission = true;

//set high resolution for print
pdfSecurityOptions.FullQualityPrintPermission = true;


pdfSaveOptions.SecurityOptions = pdfSecurityOptions;

wb.Save("output.pdf", pdfSaveOptions);

Watermark

接收或设置水标到输出。

public RenderingWatermark Watermark { get; set; }

财产价值

RenderingWatermark

Examples

下面的代码在输出PDF中设置水标。

//prepare a workbook with 3 pages.
Workbook wb = new Workbook();
wb.Worksheets[0].Cells["A1"].PutValue("Page1");
int index = wb.Worksheets.Add();
wb.Worksheets[index].Cells["A1"].PutValue("Page2");
index = wb.Worksheets.Add();
wb.Worksheets[index].Cells["A1"].PutValue("Page3");
wb.Worksheets[index].PageSetup.PaperSize = PaperSizeType.PaperA3;

//create a font for watermark, and specify bold, italic, color
RenderingFont font = new RenderingFont("Calibri", 68);
font.Italic = true;
font.Bold = true;
font.Color = Color.Blue;

//create a watermark from text and the specified font
RenderingWatermark watermark = new RenderingWatermark("Watermark", font);

//specify horizontal and vertical alignment
watermark.HAlignment = TextAlignmentType.Center;
watermark.VAlignment = TextAlignmentType.Center;

//specify rotation
watermark.Rotation = 30;

//specify opacity
watermark.Opacity = 0.6f;

//specify the scale to page(e.g. 100, 50) in percent.
watermark.ScaleToPagePercent = 50;

//spcify watermark for rendering to pdf.
PdfSaveOptions options = new PdfSaveOptions();
options.Watermark = watermark;

wb.Save("output_watermark.pdf", options);

Methods

SetImageResample(int , int , int)

设置所需的 PPI(每英寸像素)的样品图像和jpeg质量。 所有图像将以规定的质量设置转换为JPEG,超过指定的 PPI 的图像(每英寸的像素)将重新样本。

public void SetImageResample(int desiredPPI, int jpegQuality)

Parameters

desiredPPI int

每英寸想要的像素 220 高品质 150 屏幕质量 96 电子邮件质量

jpegQuality int

0 - 100% JPEG 质量。

Examples

下面的代码设置了所需的PPI为96和jpeg质量为80的图像在PDF输出。

//load the source file with images.
Workbook wb = new Workbook("Book1.xlsx");

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

//set desired PPI as 96 and jpeg quality as 80.
pdfSaveOptions.SetImageResample(96, 80);

wb.Save("output.pdf", pdfSaveOptions);
 中文