Aspose.note features

My company is considering purchasing aspose.note for conversion to PDF. When using the API, is it possible have page breaks not split the PDF tables ?

@dedomina

Yes, when using Aspose.Note for converting OneNote notebooks to PDF, you can control how page breaks affect tables and other content. The API provides several algorithms for managing how objects are split across pages during the conversion process.

To prevent tables from being split across pages, you can utilize the PdfSaveOptions class and set the PageSplittingAlgorithm property to one of the following options:

  1. KeepSolidObjectsAlgorithm: This algorithm ensures that solid objects (like tables) are kept intact and not split across pages.
  2. KeepPartAndCloneSolidObjectToNextPageAlgorithm: This option allows part of the object to remain on the current page while cloning the rest to the next page, which can be useful for larger tables.

Here is a sample code snippet demonstrating how to implement this:

using System.IO;
using Aspose.Note;
using Aspose.Note.Saving;

namespace Aspose.Note.Examples.CSharp.Loading_Saving
{
    public class PageSplitExample
    {
        public static void Run()
        {
            // Load the OneNote document
            Document doc = new Document("path_to_your_document.one");

            // Create PdfSaveOptions and set the page splitting algorithm
            var pdfSaveOptions = new PdfSaveOptions();
            pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();

            // Save the document as a PDF
            doc.Save("output.pdf", pdfSaveOptions);

            Console.WriteLine("PDF saved successfully with tables intact.");
        }
    }
}

In this example, replace "path_to_your_document.one" with the actual path to your OneNote file. This code will ensure that tables are not split across pages when converting to PDF, maintaining the integrity of your content.

For more detailed information on the conversion process and available options, you can refer to the Aspose documentation on converting notebooks to PDF here and the specific algorithms for page splitting here.

Sources:
[1]: Convert Notebooks to PDF (Flattened) in Aspose Note .NET
[2]: PageSplitUsingKeepSolidObjectsAlgorithm.cs

@dedomina,

If you are still unable to figure it out, please zip and attach your input OneNote document and a sample (runnable) code to help us evaluate your issue precisely. Additionally, please attach the current output PDF generated by Aspose.Note and the expected PDF file for reference. We will check and assist you accordingly.