Class KeepSolidObjectsAlgorithm

Class KeepSolidObjectsAlgorithm

ชื่อพื้นที่: Aspose.Note.Saving การประกอบ: Aspose.Note.dll (25.4.0)

เปลี่ยนวัตถุเต็มไปหน้าต่อไปหากไม่เหมาะสมในหน้าเดิม

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

อนุญาโตตุลาการ

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

Examples

แสดงวิธีการบันทึกหนังสือเล่มในรูปแบบ PDF ด้วยตัวเลือกที่ระบุ

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

แสดงวิธีการส่งเอกสารไปยังเครื่องพิมพ์โดยใช้คู่สนทนามาตรฐาน Windows พร้อมตัวเลือกที่ระบุ

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

เมื่อหน้า OneNote ระยะยาวจะถูกบันทึกในรูปแบบ PDF พวกเขาจะแบ่งเป็นหน้า ตัวอย่างแสดงให้เห็นว่าวิธีการตั้งค่าโลจิกการแบ่งของวัตถุที่ตั้งอยู่บนช่องว่างของหน้า

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

KeepSolidObjectsอัลกอริทึม()

เปิดตัวตัวอย่างใหม่ของ Aspose.Note.Saving.KeepSolidObjects อัลgorithm class โดยใช้ข้อ จํากัด ความสูงแบบกําหนดเองของชิ้นส่วนคลอน

public KeepSolidObjectsAlgorithm()
   {
   }

KeepSolidObjectsอัลกอริทึม(เรือ)

เริ่มต้นตัวอย่างใหม่ของ Aspose.Note.Saving.KeepSolidObjects อัลgorithm class ใช้ระดับความสูงที่เฉพาะเจาะจงของชิ้นส่วนคลอน

public KeepSolidObjectsAlgorithm(float heightLimitOfClonedPart)
   {
   }

Parameters

heightLimitOfClonedPart float

ความสูงสูงสุดของส่วนคลอน

Fields

DefaultHeightLimitOfClonedPart

ขนาดที่กําหนดเอง max ของชิ้นส่วนคลอน

public const float DefaultHeightLimitOfClonedPart = 200;

หมายเลข

float

Properties

HeightLimitOfClonedPart

ได้รับระดับความสูงของส่วนที่คลอน

public float HeightLimitOfClonedPart
   {
      get;
   }

คุณสมบัติมูลค่า

float

 แบบไทย