We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Index was outside the bounds of the array. saving Document

hi, was using our licence of aspose in one project and work correctly but now for a exercise i move the logic to other project in the same solution including the license file, and now every time i want to save a Document object and I receive this error:Index was outside the bounds of the array.


this is my code (Remember is the same code in the other project)

private static bool CreatePdf(Docu item, string dataDir)
{
try
{
if (string.IsNullOrWhiteSpace(item.NameFile))
return false;
var nameAndRoute = $"{dataDir}Temporary\{item.NameFile}.pdf";
var doc = new Document();
doc.Pages.Add(item.Page1);
doc.Pages.Add(item.Page2);
if (item.Page3 != null)
{
doc.Pages.Add(item.Page3);
}
doc.Save(nameAndRoute);
return true;
}
catch (Exception ex)
{
return false;
}
}

Hi There,


Thanks for contacting support.

I have tried to create a PDF document using the code snippet which you have shared and was unable to notice any issue. We will really appreciate if you please share a sample project along with sample input document(s). It will really help us in replicating the issue which you are facing and address it accordingly. We are sorry for the inconvenience.


Best Regards,