Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: bottom spacing for page numbers

Sidwebworks2b8ef62f3050
diff --git a/apps/erp/app/routes/file+/job+/$jobId.traveler[.]pdf.tsx b/apps/erp/app/routes/file+/job+/$jobId.traveler[.]pdf.tsx
index 507a40e6b1..206cc96533 100644
--- a/apps/erp/app/routes/file+/job+/$jobId.traveler[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/job+/$jobId.traveler[.]pdf.tsx
@@ -1,6 +1,6 @@
import { getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
-import { JobTravelerPageContent } from "@carbon/documents/pdf";
+import { Footer, JobTravelerPageContent } from "@carbon/documents/pdf";
import type { JSONContent } from "@carbon/react";
import { flattenTree, generateBomIds } from "@carbon/utils";
import {
@@ -173,7 +173,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const styles = StyleSheet.create({
body: {
fontFamily: "Inter",
- padding: "20px 40px",
+ padding: "20px 40px 50px 40px",
color: "#000000",
backgroundColor: "#FFFFFF"
}
@@ -204,6 +204,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
companySettings.data?.jobTravelerIncludeWorkInstructions ?? false
}
/>
+ <Footer />
</Page>
))}
</Document>
diff --git a/packages/documents/src/pdf/KanbanLabelPDF.tsx b/packages/documents/src/pdf/KanbanLabelPDF.tsx
index e4c2f26e5d..08dec7d1c7 100644
--- a/packages/documents/src/pdf/KanbanLabelPDF.tsx
+++ b/packages/documents/src/pdf/KanbanLabelPDF.tsx
@@ -52,10 +52,13 @@ const KanbanLabelPDF = ({
const LETTER_WIDTH = 8.5 * 72;
const LETTER_HEIGHT = 11 * 72;
+ // Reserve space for the footer (page number) at the bottom
+ const footerHeight = 35;
+
// Calculate label dimensions for 2x3 layout with margins
const margin = 36; // 0.5 inch margins
const labelWidth = (LETTER_WIDTH - 2 * margin) / columns;
- const labelHeight = (LETTER_HEIGHT - 2 * margin) / rows;
+ const labelHeight = (LETTER_HEIGHT - 2 * margin - footerHeight) / rows;
// Calculate how many pages we need
const labelsPerPage = rows * columns;
diff --git a/packages/documents/src/pdf/ProductLabelPDF.tsx b/packages/documents/src/pdf/ProductLabelPDF.tsx
index 188772bfd2..a6f7f43fbf 100644
--- a/packages/documents/src/pdf/ProductLabelPDF.tsx
+++ b/packages/documents/src/pdf/ProductLabelPDF.tsx
@@ -73,10 +73,15 @@ const ProductLabelPDF = ({ items, labelSize }: ProductLabelProps) => {
const labelsPerPage = rows * columns;
const pageCount = Math.ceil(items.length / labelsPerPage);
+ // Reserve space for the footer (page number) at the bottom
+ const footerHeight = 35;
+
// Calculate margins to center labels on the page
// Use effective dimensions for rotated labels
const horizontalMargin = (pageWidth - columns * effectiveLabelWidthPt) / 2;
- const verticalMargin = (pageHeight - rows * effectiveLabelHeightPt) / 2;
+ const availableHeight =
+ rows > 1 || columns > 1 ? pageHeight - footerHeight : pageHeight;
+ const verticalMargin = (availableHeight - rows * effectiveLabelHeightPt) / 2;
return (
<Document>
diff --git a/packages/documents/src/pdf/components/Template.tsx b/packages/documents/src/pdf/components/Template.tsx
index a49366e030..09afa7a90c 100644
--- a/packages/documents/src/pdf/components/Template.tsx
+++ b/packages/documents/src/pdf/components/Template.tsx
@@ -38,7 +38,7 @@ const Template = ({ title, meta, footerLabel, children }: TemplateProps) => {
const styles = StyleSheet.create({
body: {
fontFamily: "Inter",
- padding: "20px 40px",
+ padding: "20px 40px 50px 40px",
color: "#000000",
backgroundColor: "#FFFFFF"
}
diff --git a/packages/documents/src/pdf/index.ts b/packages/documents/src/pdf/index.ts
index ec23fcbd73..7ebb7e180f 100644
--- a/packages/documents/src/pdf/index.ts
+++ b/packages/documents/src/pdf/index.ts
@@ -1,3 +1,4 @@
+import { Footer } from "./components";
import IssuePDF from "./IssuePDF";
import JobTravelerPDF, { JobTravelerPageContent } from "./JobTravelerPDF";
import KanbanLabelPDF from "./KanbanLabelPDF";
@@ -9,6 +10,7 @@ import SalesInvoicePDF from "./SalesInvoicePDF";
import SalesOrderPDF from "./SalesOrderPDF";
import StockTransferPDF from "./StockTransferPDF";
export {
+ Footer,
IssuePDF,
JobTravelerPageContent,
JobTravelerPDF,