Class AlwaysSplitObjectsAlgorithm
Class AlwaysSplitObjectsAlgorithm
Το όνομα: Aspose.Note.Saving Συγκέντρωση: Aspose.Note.dll (25.4.0)
Διαχωρίστε ένα αντικείμενο σε διάφορα μέρη σε περίπτωση που δεν ταιριάζει στην αρχική σελίδα.
public class AlwaysSplitObjectsAlgorithm : PageSplittingAlgorithm
{
private readonly double _splitDistance;
public AlwaysSplitObjectsAlgorithm(double splitDistance)
{
_splitDistance = splitDistance;
}
protected override void SplitPagesCore(Document doc, int startPageIndex, int endPageIndex, PageSplittingCriteria criteria)
{
for (int i = startPageIndex; i < endPageIndex; i++)
{
SplitPage(doc, i);
}
}
private void SplitPage(Document doc, int pageIndex)
{
Page page = doc.GetPage(pageIndex);
Aspose.Words.CheckBox checkBox;
if (page.Paragraphs.Count > 0)
{
Paragraph lastParagraph = page.Paragraphs[page.Paragraphs.Count - 1];
Node nextNode = lastParagraph.NextSibling;
if (nextNode != null && nextNode is CheckBox checkBoxNextNode)
{
checkBox = checkBoxNextNode as Aspose.Words.CheckBox;
}
}
if (checkBox == null)
{
return;
}
double distanceToCheckBox = GetDistanceToCheckBox(page, checkBox);
if (distanceToCheckBox <= _splitDistance)
{
SplitPageHorizontally(doc, pageIndex);
}
}
private double GetDistanceToCheckBox(Page page, Aspose.Words.CheckBox checkBox)
{
}
private void SplitPageHorizontally(Document doc, int pageIndex)
{
}
}
Inheritance
object ← PageSplittingAlgorithm ← AlwaysSplitObjectsAlgorithm
Κληρονομημένα μέλη
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 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
ΠάνταΣπλίτObjectsAlgorithm()
public AlwaysSplitObjectsAlgorithm()
{
}