Comment #1 from SwissCoder was right. AddImageHtml
already adds the first page. After also contacting the WebSuperGoo support, they recommend me to use PageCount
of class Doc
.
while (true)
{
if (!pdfDocument.Chainable(documentId))
{
break;
}
pdfDocument.Page = pdfDocument.AddPage();
if (pdfDocument.PageCount >= 3)
pdfDocument.Rect.Inset(0, 20);
documentId = pdfDocument.AddImageToChain(documentId);
}
The other solution would be to adjust the index to count unto required pagenumber - 1
as ÀddImageHtml
already adds the first page to the document.