Class KeepSolidObjectsAlgorithm

Class KeepSolidObjectsAlgorithm

Tên không gian: Aspose.Note.Saving Tổng hợp: Aspose.Note.dll (25.4.0)

Chuyển đổi đối tượng đầy đủ sang trang tiếp theo nếu nó không phù hợp với trang ban đầu.

public class KeepSolidObjectsAlgorithm : PageSplittingAlgorithm
   {
      private readonly double _minimumSpaceBetweenPages;
      private readonly double _maximumSpaceBetweenPages;
      public KeepSolidObjectsAlgorithm(double minimumSpaceBetweenPages, double maximumSpaceBetweenPages)
      {
         _minimumSpaceBetweenPages = minimumSpaceBetweenPages;
         _maximumSpaceBetweenPages = maximumSpaceBetweenPages;
      }
      protected override void AddPageBreak(Document document, PageLayout pageLayout, float pageNumber, bool isLastPageInSection)
      {
         double spaceBefore = FindSpaceBefore(document, pageLayout);
         if (IsSufficientSpaceForNextPage(spaceBefore))
            return;
         AddSpaceBetweenPages(document, pageNumber);
      }
      private bool IsSufficientSpaceForNextPage(double spaceBefore)
      {
         double sufficientSpace = _minimumSpaceBetweenPages;
         if (sufficientSpace > spaceBefore)
            sufficientSpace = spaceBefore;
         if (sufficientSpace >= _maximumSpaceBetweenPages)
            return true;
         return false;
      }
      private void AddSpaceBetweenPages(Document document, float pageNumber)
      {
         double spaceToAdd = FindNextPageStartPosition(document, pageNumber + 1) - GetLastContentEndPosition(document, pageNumber);
         if (spaceToAdd > 0.0)
            AddSpace(document, spaceToAdd);
      }
      private void AddSpace(Document document, double spaceToAdd)
      {
      }
   }

Inheritance

object PageSplittingAlgorithm KeepSolidObjectsAlgorithm

Thành viên thừa kế

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

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.

string dataDir = RunExamples.GetDataDir_NoteBook();
   var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
   var notebookSaveOptions = new NotebookPdfSaveOptions();
   var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
   documentSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
   dataDir += "ConvertToPDF_out.pdf";
   notebook.Save(dataDir, notebookSaveOptions);

Hiển thị cách gửi tài liệu đến một máy in bằng cách sử dụng đối thoại Windows tiêu chuẩn với các tùy chọn được chỉ định.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   var document = new Aspose.Note.Document(dataDir + "Aspose.one");
   var printerSettings = new PrinterSettings()
   {
      FromPage = 0,
      ToPage = 10
   };
   printerSettings.DefaultPageSettings.Landscape = true;
   printerSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 150, 50);
   document.Print(new PrintOptions()
   {
      PrinterSettings = printerSettings,
      Resolution = 1200,
      PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(),
      DocumentName = "Test.one"
   });

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 .

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   var pdfSaveOptions = new PdfSaveOptions();
   pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
   float heightLimitOfClonedPart = 500;
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);
   dataDir += "UsingKeepSOlidObjectsAlgorithm_out.pdf";
   doc.Save(dataDir);

Constructors

Thảo luậnSolidObjectsAlgorithm()

Bắt đầu một trường hợp mới của lớp Aspose.Note.Saving.KeepSolidObjectsAlgorithm bằng cách sử dụng giới hạn chiều cao mặc định của bộ phận được clon.

public KeepSolidObjectsAlgorithm()
   {
   }

KeepSolidObjectsAlgorithm(hạm đội)

Bắt đầu một trường hợp mới của lớp Aspose.Note.Saving.KeepSolidObjectsAlgorithm bằng cách sử dụng giới hạn chiều cao cụ thể của các bộ phận được clon.

public KeepSolidObjectsAlgorithm(float heightLimitOfClonedPart)
   {
   }

Parameters

heightLimitOfClonedPart float

Độ cao tối đa của phần clone.

Fields

DefaultHeightLimitOfClonedPart

Kích thước mặc định max của phần clone.

public const float DefaultHeightLimitOfClonedPart = 200;

Giá trị Field

float

Properties

HeightLimitOfClonedPart

Nó nhận được giới hạn chiều cao của phần clone.

public float HeightLimitOfClonedPart
   {
      get;
   }

Giá trị bất động sản

float

 Tiếng Việt