Class PdfSaveOptions
Tên không gian: Aspose.Note.Saving Tổng hợp: Aspose.Note.dll (25.4.0)
Cho phép xác định các tùy chọn bổ sung khi trình bày các trang tài liệu sang PDF.
public sealed class PdfSaveOptions : SaveOptions
Inheritance
object ← SaveOptions ← PdfSaveOptions
Thành viên thừa kế
SaveOptions.SaveFormat , SaveOptions.FontsSubsystem , SaveOptions.PageIndex , SaveOptions.PageCount , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Hiển thị cách lưu một tài liệu trong định dạng PDF với bố trí trang Thư.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingLetterPageSettings.pdf");
// Save the document.
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.Letter });
Hiển thị cách lưu một tài liệu trong định dạng PDF với bố trí trang A4 mà không có giới hạn chiều cao.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingA4PageSettingsWithoutHeightLimit.pdf");
// Save the document.
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.A4NoHeightLimit });
Hiển thị cách lưu sổ tay trong định dạng PDF với các tùy chọn được chỉ định.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
var notebookSaveOptions = new NotebookPdfSaveOptions();
var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
documentSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
dataDir = dataDir + "ConvertToPDF_out.pdf";
// Save the Notebook
notebook.Save(dataDir, notebookSaveOptions);
Khi các trang OneNote dài được lưu trữ trong định dạng pdf, chúng được phân chia qua mỗi trang. mẫu cho thấy cách thiết lập logic chia của các đối tượng nằm trên các khoảng trống của Trang.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
// or
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);
dataDir = dataDir + "PageSplittUsingKeepPartAndCloneSolidObjectToNextPageAlgorithm_out.pdf";
doc.Save(dataDir);
Hiển thị cách lưu một tài liệu trong định dạng PDF.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document oneFile = new Document(dataDir + "Aspose.one");
// Initialize PdfSaveOptions object
PdfSaveOptions opts = new PdfSaveOptions
{
// Set page index of first page to be saved
PageIndex = 0,
// Set page count
PageCount = 1,
};
// Save the document as PDF
dataDir = dataDir + "SaveRangeOfPagesAsPDF_out.pdf";
oneFile.Save(dataDir, opts);
Hiển thị cách lưu một tài liệu trong định dạng PDF bằng cách sử dụng cài đặt cụ thể.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
// Initialize PdfSaveOptions object
PdfSaveOptions opts = new PdfSaveOptions
{
// Use Jpeg compression
ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
// Quality for JPEG compression
JpegQuality = 90
};
dataDir = dataDir + "Document.SaveWithOptions_out.pdf";
doc.Save(dataDir, opts);
Khi các trang dài của OneNote được lưu trữ trong định dạng pdf, chúng được chia thành mỗi trang. ví dụ này cho thấy cách thiết lập logic chia của các đối tượng nằm trên các khoảng trống của trang .
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
float heightLimitOfClonedPart = 500;
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);
dataDir = dataDir + "UsingKeepSOlidObjectsAlgorithm_out.pdf";
doc.Save(dataDir);
Constructors
PdfSaveOptions()
public PdfSaveOptions()
Properties
ImageCompression
Nhận hoặc đặt loại nén áp dụng cho hình ảnh trong tệp PDF.
public PdfImageCompression ImageCompression { get; set; }
Giá trị bất động sản
Examples
Hiển thị cách lưu một tài liệu trong định dạng PDF bằng cách sử dụng cài đặt cụ thể.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
// Initialize PdfSaveOptions object
PdfSaveOptions opts = new PdfSaveOptions
{
// Use Jpeg compression
ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
// Quality for JPEG compression
JpegQuality = 90
};
dataDir = dataDir + "Document.SaveWithOptions_out.pdf";
doc.Save(dataDir, opts);
JpegQuality
Nhận hoặc đặt một giá trị xác định chất lượng của hình ảnh JPEG bên trong tài liệu PDF.Giá trị có thể thay đổi từ 0 đến 100, nơi 0 có nghĩa là chất lượng tồi tệ nhất nhưng áp lực tối đa và 100 có giá trị tốt nhất mà áp suất tối thiểu.
public int JpegQuality { get; set; }
Giá trị bất động sản
Examples
Hiển thị cách lưu một tài liệu trong định dạng PDF bằng cách sử dụng cài đặt cụ thể.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
// Initialize PdfSaveOptions object
PdfSaveOptions opts = new PdfSaveOptions
{
// Use Jpeg compression
ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
// Quality for JPEG compression
JpegQuality = 90
};
dataDir = dataDir + "Document.SaveWithOptions_out.pdf";
doc.Save(dataDir, opts);
Remarks
Giá trị mặc định là 90.
PageSettings
Nhận hoặc đặt cài đặt trang cho mỗi trang trong tài liệu.Theo mặc định, tùy thuộc vào CurrentUICulture, *Những nền văn hóa Hoa Kỳ có cài đặt thư, những người khác có thiết đặt A4.
public PageSettings PageSettings { get; set; }
Giá trị bất động sản
Examples
Hiển thị cách lưu một tài liệu trong định dạng PDF với bố trí trang Thư.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingLetterPageSettings.pdf");
// Save the document.
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.Letter });
Hiển thị cách lưu một tài liệu trong định dạng PDF với bố trí trang A4 mà không có giới hạn chiều cao.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingA4PageSettingsWithoutHeightLimit.pdf");
// Save the document.
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.A4NoHeightLimit });
PageSplittingAlgorithm
Nhận hoặc thiết lập các thuật toán được sử dụng để chia trang.
public PageSplittingAlgorithm PageSplittingAlgorithm { get; set; }
Giá trị bất động sản
Examples
Hiển thị cách lưu sổ tay trong định dạng PDF với các tùy chọn được chỉ định.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
var notebookSaveOptions = new NotebookPdfSaveOptions();
var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
documentSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
dataDir = dataDir + "ConvertToPDF_out.pdf";
// Save the Notebook
notebook.Save(dataDir, notebookSaveOptions);
Khi các trang OneNote dài được lưu trữ trong định dạng pdf, chúng được phân chia qua mỗi trang. mẫu cho thấy cách thiết lập logic chia của các đối tượng nằm trên các khoảng trống của Trang.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
// or
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);
dataDir = dataDir + "PageSplittUsingKeepPartAndCloneSolidObjectToNextPageAlgorithm_out.pdf";
doc.Save(dataDir);
Khi các trang dài của OneNote được lưu trữ trong định dạng pdf, chúng được chia thành mỗi trang. ví dụ này cho thấy cách thiết lập logic chia của các đối tượng nằm trên các khoảng trống của trang .
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Load the document into Aspose.Note.
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
float heightLimitOfClonedPart = 500;
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
// Or
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);
dataDir = dataDir + "UsingKeepSOlidObjectsAlgorithm_out.pdf";
doc.Save(dataDir);