It seems like DrawImage uses pdfmargins to calculate x,y but DrawString disregards margins.
Is that true?
My code has this:
Pages.Add(PdfPageSize.Letter, new PdfMargins(leftRightMarginPoints,topBottomMarginPoints));
Canvas.DrawImage(pdfImage, 0, 0, widthPoints, heightPoints);
Canvas.DrawString(fieldValue, font, brush, textBoundingRectanglePoints, stringFormatAlignment);
My image gets positioned at left and top margin, but my text goes exactly to textBoundingRectanglePoints no matter what pdfmargins are.
A few hours later... I see my real problem! Can someone explain this?
PdfDocument doc = new PdfDocument();
PdfPageBase page1 = doc.Pages.Add(PdfPageSize.Letter, new PdfMargins(leftRightMarginPoints,topBottomMarginPoints));
I expect (page1 == doc.Pages[0]) to be true; but it is false!!!
page knows about my margins; but doc.Pages[0] does not know about my margins.
Why is doc.Pages[0] not equal to page1? I pass doc to other methods and assume doc.Pages[0] will give me page1.
Is there a way to get page1 if you have doc?