Class KeepPartAndCloneSolidObjectToNextPageAlgorithm

Class KeepPartAndCloneSolidObjectToNextPageAlgorithm

Le nom : Aspose.Note.Saving Assemblée: Aspose.Note.dll (25.4.0)

Ajouter la partie supérieure de l’objet au fond de la page et clonner le tout à la prochaine page si elle ne correspond pas dans la première page.

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

I membri ereditari

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

Examples

Lorsque de longues pages OneNote sont enregistrées dans le format pdf, elles sont divisées entre pages.L’échantillon montre comment configurer la logique de séparation des objets situés sur les ruptures de la page.

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

Lorsque de longues pages OneNote sont enregistrées dans le format pdf, elles sont divisées entre pages.L’exemple montre comment configurer la logique de séparation des objets situés sur les ruptures de la page.

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

Mise à jourPageAlgorithme()

Initialisez une nouvelle instance du Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm class, en utilisant la limite de hauteur par défaut de la partie clonée.

public KeepPartAndCloneSolidObjectToNextPageAlgorithm()
   {
   }

KeepPartAndCloneSolidObjectToNextPageAlgorithme(float)

Initialiser une nouvelle instance du Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm classe, en utilisant un limite de hauteur spécifique de la partie clonée.

public KeepPartAndCloneSolidObjectToNextPageAlgorithm(float heightLimitOfClonedPart)
   {
   }

Parameters

heightLimitOfClonedPart float

La hauteur max de la partie clonée.

Fields

DefaultHeightLimitOfClonedPart

La taille max de la partie clonée.

public const float DefaultHeightLimitOfClonedPart = 200;

Valore di campo

float

Properties

HeightLimitOfClonedPart

Il obtient la limite de hauteur de la partie clonée.

public float HeightLimitOfClonedPart
   {
      get;
   }

Valore di proprietà

float

 Français