示例#1
0
    $grid_x = $X_offset + $wall_thickness;
    $pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
    $grid_x += $box_width + $X_spacing;
    $pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
    $grid_x += $box_width + $X_spacing;
    $pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
    $grid_x += $box_width + $X_spacing;
    $pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
}
// draw top and bottom
$pdf->SetLineStyle($shape_style);
shift_points($points_lid, $box_width + $X_spacing + $X_offset, $Y_offset);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// true denotes a closed polygon, very important
shift_points($points_lid, 0, ($box_height + $Y_spacing) * 2);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// draw four sides
shift_points($points_side, $X_offset, $box_height + $Y_spacing + $Y_offset);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('box_generator.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
示例#2
0
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
// ***********************************
//     Drawing routines
// ***********************************
// draw top and bottom
$pdf->SetLineStyle($shape_style);
shift_points($points_lid, $X_offset, $Y_offset);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// true denotes a closed polygon, very important
shift_points($points_lid, $box_width + $X_spacing, 0);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// draw front and back
shift_points($points_front, $X_offset, $Y_offset + $box_depth + $Y_spacing);
$pdf->Polygon($points_front, '', $shape_style, array(), true);
shift_points($points_front, $box_width + $X_spacing, 0);
$pdf->Polygon($points_front, '', $shape_style, array(), true);
// draw two sides
shift_points($points_side, $X_offset + ($box_width + $X_spacing) * 2, $Y_offset);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, 0, $box_height + $Y_spacing);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('tmp/box_generator.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+