Class PdfSaveOptions

Class PdfSaveOptions

Nom dels espais: Aspose.Note.Saving Assemblea: Aspose.Note.dll (25.4.0)

Permet especificar opcions addicionals en renderitzar pàgines de document a PDF.

public sealed class PdfSaveOptions : SaveOptions

Inheritance

object SaveOptions PdfSaveOptions

Membres heretats

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

Mostra com guardar un document en format PDF amb el disseny de la pàgina de lletra.

// 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 });

Mostra com guardar un document en format PDF amb el disseny de la pàgina A4 sense límit d’altura.

// 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 });

Mostra com salvar el notebook en format pdf amb les opcions especificades.

// 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);

Quan les llargues pàgines de OneNote s’emmagatzemen en format pdf, es divideixen entre pàgs.La mostra mostra com configurar la lògica de divisió dels objectes localitzats en les pauses de la pàgina.

// 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);

Mostra com guardar un document en format 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);

Mostra com guardar un document en format pdf utilitzant configuracions específiques.

// 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);

Quan les llargues pàgines de OneNote s’emmagatzemen en format pdf, es divideixen entre pàgs. L’exemple mostra com configurar la lògica de divisió dels objectes localitzats en les pauses de la pàgina.

// 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

Obté o estableix el tipus de compressió aplicada a les imatges en el fitxer PDF.

public PdfImageCompression ImageCompression { get; set; }

Valor de la propietat

PdfImageCompression

Examples

Mostra com guardar un document en format pdf utilitzant configuracions específiques.

// 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

Obté o estableix un valor que determina la qualitat de les imatges JPEG dins del document PDF.El valor pot variar de 0 a 100 on 0 significa pitjor qualitat però màxima compressió i 100 significa millor qualitat, però mínima compresssió.

public int JpegQuality { get; set; }

Valor de la propietat

int

Examples

Mostra com guardar un document en format pdf utilitzant configuracions específiques.

// 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

El valor estàndard és 90.

PageSettings

Obté o estableix les configuracions de la pàgina per a cada pàgina en el document.Per default depèn de CurrentUICulture, *Cultures dels EUA tenen la configuració de lletra, d’altres tenen les configuracions A4.

public PageSettings PageSettings { get; set; }

Valor de la propietat

PageSettings

Examples

Mostra com guardar un document en format PDF amb el disseny de la pàgina de lletra.

// 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 });

Mostra com guardar un document en format PDF amb el disseny de la pàgina A4 sense límit d’altura.

// 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

Obtenir o establir l’algoritme utilitzat per a la divisió de pàgines.

public PageSplittingAlgorithm PageSplittingAlgorithm { get; set; }

Valor de la propietat

PageSplittingAlgorithm

Examples

Mostra com salvar el notebook en format pdf amb les opcions especificades.

// 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);

Quan les llargues pàgines de OneNote s’emmagatzemen en format pdf, es divideixen entre pàgs.La mostra mostra com configurar la lògica de divisió dels objectes localitzats en les pauses de la pàgina.

// 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);

Quan les llargues pàgines de OneNote s’emmagatzemen en format pdf, es divideixen entre pàgs. L’exemple mostra com configurar la lògica de divisió dels objectes localitzats en les pauses de la pàgina.

// 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);
 Català