Implementation
static void drawFrame(
pw.Context context,
PdfPageFormat pageFormat, {
required String projectTitle,
required String clientName,
required String engineerName,
String sheetNumber = "1 de 1",
String scale = "S/E",
}) {
final canvas = context.canvas;
// 1. Define Margins (20mm Left, 10mm others) based on A3/A4
// 1mm ~ 2.835 points
const double mm = PdfPageFormat.mm;
const double leftMargin = 20 * mm;
const double otherMargin = 10 * mm;
final double width = pageFormat.width;
final double height = pageFormat.height;
final double drawWidth = width - leftMargin - otherMargin;
final double drawHeight = height - (otherMargin * 2);
// Frame Outline
canvas.setColor(PdfColors.black);
canvas.setLineWidth(
1.0); // 0.5mm is roughly 1.4pt, lets use 1.0 for visible frame
canvas.drawRect(leftMargin, otherMargin, drawWidth, drawHeight);
canvas.strokePath();
// 2. Coordinate Grid (Optional but requested)
// 1-8 Horizontal, A-F Vertical
_drawGridMarks(canvas, leftMargin, otherMargin, drawWidth, drawHeight);
// 3. Title Block (CajetÃn) - Bottom Right fixed size
// 180mm width standard for title blocks? Or adhere to space.
// Let's make it 190mm wide x 30mm high approx.
const double tbWidth = 190 * mm;
const double tbHeight = 35 * mm;
final double tbX = width - otherMargin - tbWidth;
const double tbY = otherMargin;
_drawTitleBlock(canvas, tbX, tbY, tbWidth, tbHeight, projectTitle,
clientName, engineerName, sheetNumber, scale);
}