Document. Save () is caught in an infinite loop

Document pdfDocument = new Document();
pdfDocument.PageInfo.Width = 612;
pdfDocument.PageInfo.Height = 792;
pdfDocument.PageInfo.Margin = new MarginInfo(28.8, 28.8, 28.8, 28.8);

Execute my code…

pdfDocument.Save();

Why is this when you get an infinite loop if you save it after performing the above sequence?

@Junyoung,

We are unable to replicate the problem of infinite loop in our environment. Please send us the complete code. We will investigate your scenario in our environment, and share our findings with you.

This will not end the Save().

namespace Sample
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
License license = new License();

		FileStream fs = new FileStream("~/Aspose.Pdf.lic", FileMode.Open);

		license.SetLicense(fs);

		fs.Dispose();
	}

	protected void Page_Load(object sender, EventArgs e)
	{
		SetCanvasSetting();
	}

	public void SetCanvasSetting()
	{
		Document doc = new Document();
		doc.PageInfo.Width = 612;
		doc.PageInfo.Height = 792;
		doc.PageInfo.Margin = new MarginInfo(28.8, 28.8, 28.8, 28.8);

		Page page = null;
		Table table = null;
		Row row = null;
		Cell cell = null;
		TextFragment fragment = null;

		for (int i = 0; i < 100; i++)
		{
			page = doc.Pages.Add();
			table = new Table();
			row = table.Rows.Add();
			cell = row.Cells.Add();

			table.ColumnWidths = (doc.PageInfo.Width - doc.PageInfo.Margin.Left - doc.PageInfo.Margin.Right).ToString();
			row.FixedRowHeight = doc.PageInfo.PureHeight;
			cell.Border = new BorderInfo(BorderSide.All, 1);

			for (int j = 0; j < 10; j++)
			{
				fragment = new TextFragment("Test Test Test Test Test Test Test");
				cell.Paragraphs.Add(fragment);
			}

			page.Paragraphs.Add(table);
		}

		doc.Save("Save Path");
		doc.Dispose();
	}
}

}

@Junyoung,

We managed to replicate the problem of infinite execution of the Save method in our environment. An investigation has been logged under the ticket ID PDFNET-44784 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.