Class KeepPartAndCloneSolidObjectToNextPageAlgorithm

Class KeepPartAndCloneSolidObjectToNextPageAlgorithm

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

Thêm phần trên của đối tượng vào phần dưới cùng của trang và clone toàn bộ mục vào trang tiếp theo nếu nó không phù hợp với trang ban đầu.

public class KeepPartAndCloneSolidObjectToNextPageAlgorithm : PageSplittingAlgorithm
   {
      private bool _keepWithNext;
      private Shape _clonedShape;
      public KeepPartAndCloneSolidObjectToNextPageAlgorithm()
      {
         _keepWithNext = false;
         _clonedShape = null;
      }
      protected override bool ShouldSplit(Node node)
      {
         if (node is Shape shape && !_keepWithNext && shape.Type == ShapeType.SolidObject)
         {
            CloneSolidObject(shape);
            _keepWithNext = true;
            return false;
         }
         _keepWithNext = false;
         return base.ShouldSplit(node);
      }
      private void CloneSolidObject(Shape shape)
      {
         if (shape.IsTextFrame)
         {
            _clonedShape = shape.Clone();
         }
         else
         {
            using (var memoryStream = new MemoryStream())
            {
               shape.CopyTo(memoryStream);
               _clonedShape = Shape.FromPKI(memoryStream);
            }
         }
      }
   }

Inheritance

object PageSplittingAlgorithm KeepPartAndCloneSolidObjectToNextPageAlgorithm

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

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.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   var pdfSaveOptions = new PdfSaveOptions();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);
   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 .

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

Constructors

KeepPartAndCloneSolidObjectToNextPageAlgorithm()

Bắt đầu một trường hợp mới của Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm class, sử dụng giới hạn chiều cao mặc định của phần clone.

public KeepPartAndCloneSolidObjectToNextPageAlgorithm()
   {
   }

KeepPartAndCloneSolidObjectToNextPageAlgorithm(tạm dịch)

Bắt đầu một trường hợp mới của Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm lớp, sử dụng giới hạn chiều cao cụ thể của phần clone.

public KeepPartAndCloneSolidObjectToNextPageAlgorithm(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