PdfImporter.Import

Import(Stream, PdfImportOptions)

Imports content of PDF document from a provided stream.

public static List<Page> Import(Stream stream, PdfImportOptions options = null)
ParameterTypeDescription
streamStreamThe stream.
optionsPdfImportOptionsThe options.

Return Value

The PdfImporter.

See Also


Import(string, PdfImportOptions)

Imports content of PDF document from a specified file.

public static List<Page> Import(string file, PdfImportOptions options = null)
ParameterTypeDescription
fileStringThe PDF file.
optionsPdfImportOptionsThe options.

Return Value

The PdfImporter.

Examples

Shows how to import all pages from PDF document grouping every 5 pages to a single OneNote page.

string dataDir = RunExamples.GetDataDir_Import();

var d = new Document();

var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

IEnumerable<Page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
while (pages.Any())
{
    d.Merge(pages.Take(5), mergeOptions);
    pages = pages.Skip(5);
}

d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));

See Also