Class PdfSaveOptions
Namespace: Aspose.Note.Saving
Assembly: Aspose.Note.dll (24.12.0)
Allows to specify additional options when rendering document pages to PDF.
public sealed class PdfSaveOptions : SaveOptions
Inheritance
object ← SaveOptions ← PdfSaveOptions
Inherited Members
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
Shows how to save a document in Pdf format with Letter page layout.```csharp // 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 });
Shows how to save a document in Pdf format with A4 page layout without height limit.```csharp
// 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 });
Shows how to save notebook in pdf format with specified options.```csharp // 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);
When long OneNote pages are saved in pdf format they are split across pages. The sample shows how to configure the splitting logic of objects located on page's breaks.```csharp
// 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);
Shows how to save a document in pdf format.```csharp // 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);
Shows how to save a document in pdf format using specific settings.```csharp
// 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);
When long OneNote pages are saved in pdf format they are split across pages. The example shows how to configure the splitting logic of objects located on page’s breaks.```csharp // 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
### <a id="Aspose_Note_Saving_PdfSaveOptions__ctor"></a> PdfSaveOptions\(\)
```csharp
public PdfSaveOptions()
Properties
ImageCompression
Gets or sets the type of compression applied to images in the PDF file.
public PdfImageCompression ImageCompression { get; set; }
Property Value
Examples
Shows how to save a document in pdf format using specific settings.```csharp // 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);
### <a id="Aspose_Note_Saving_PdfSaveOptions_JpegQuality"></a> JpegQuality
Gets or sets a value determining the quality of the JPEG images inside PDF document.
The value may vary from 0 to 100 where 0 means worst quality but maximum compression and 100 means best quality but minimum compression.
```csharp
public int JpegQuality { get; set; }
Property Value
Examples
Shows how to save a document in pdf format using specific settings.```csharp // 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
The default value is 90.
### <a id="Aspose_Note_Saving_PdfSaveOptions_PageSettings"></a> PageSettings
Gets or sets the page settings for each page in document.
By default depends on CurrentUICulture, *US cultures have letter setting, other have A4 settings.
```csharp
public PageSettings PageSettings { get; set; }
Property Value
Examples
Shows how to save a document in Pdf format with Letter page layout.```csharp // 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 });
Shows how to save a document in Pdf format with A4 page layout without height limit.```csharp
// 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
Gets or sets algorithm used for page splitting.
public PageSplittingAlgorithm PageSplittingAlgorithm { get; set; }
Property Value
Examples
Shows how to save notebook in pdf format with specified options.```csharp // 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);
When long OneNote pages are saved in pdf format they are split across pages. The sample shows how to configure the splitting logic of objects located on page's breaks.```csharp
// 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);
When long OneNote pages are saved in pdf format they are split across pages. The example shows how to configure the splitting logic of objects located on page’s breaks.```csharp // 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);