PageBreak Error when using a valid license

Hi all.

We are trying to add a PageBreak in an existing PDF but when we use our license file we have an error, which do not exist when we do not set the license.
Here is the error :
Invalid index: index should be in the range [1…n] where n equals to the operators count.

Code is simple :
// instantiate Document instance
Document doc = new Document(@“C:\Temp\Test\Test_1f_Recto.pdf”);
// instantiate blank Document instance
Document dest = new Document();
// create PdfFileEditor object
PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.AddPageBreak(doc, dest, new PdfFileEditor.PageBreak[]
{
new PdfFileEditor.PageBreak(1, 1)
});
// save resultant file
dest.Save(@“C:\Temp\Test\Test_1f_Recto_PageBreak.pdf”);

Error appear at the line which add the PageBreak.

Thanks for your help !

@fabrice.hautot

When you use the API without setting a license, it has access to limited number of items in a collection e.g. Pages, TextFragments, etc. So it is possible that API skips the part or does not reach there due to trial limitation and error does not happen.

Furthermore, please try to add a page in newly created document like below and run your code again. In case you still face any issue, please let us know by sharing the sample source PDF.

Document dest = new Document();
// create a page now
dest.Pages.Add();