Class KeepPartAndCloneSolidObjectToNextPageAlgorithm
Class KeepPartAndCloneSolidObjectToNextPageAlgorithm
名称: Aspose.Note.Saving 集合: Aspose.Note.dll (25.4.0)
将对象的顶部添加到页面的底部,并将整个对物列到下一页,如果它不适合原始页面。
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
继承人
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
当长 OneNote 页面存储在 PDF 格式时,它们分为各页。
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);
当长长的 OneNote 页面存储在 PDF 格式时,它们分为各页。
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()
启动一个新的例子 Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm 类,使用默认高度限制的克隆部分。
public KeepPartAndCloneSolidObjectToNextPageAlgorithm()
{
}
KeepPartAndCloneSolidObjectToNextPageAlgorithm(浮动)
启动一个新的例子 Aspose.Note.Saving.KeepPartAndCloneSolidObjectToNextPageAlgorithm 类,使用特定的高度限制的克隆部分。
public KeepPartAndCloneSolidObjectToNextPageAlgorithm(float heightLimitOfClonedPart)
{
}
Parameters
heightLimitOfClonedPart
float
克隆部分的最大高度。
Fields
DefaultHeightLimitOfClonedPart
默认的 max 尺寸的克隆部分。
public const float DefaultHeightLimitOfClonedPart = 200;
领域价值
Properties
HeightLimitOfClonedPart
得到了克隆部分的高度限制。
public float HeightLimitOfClonedPart
{
get;
}