@jcyao/print-sdk 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -211,8 +211,9 @@ function generatePrintPageStyles(config) {
211
211
 
212
212
  @media print {
213
213
  body {
214
- background: white;
215
- padding: 0;
214
+ margin: 0 !important;
215
+ padding: 0 !important;
216
+ background: white !important;
216
217
  }
217
218
 
218
219
  @page {
@@ -221,9 +222,9 @@ function generatePrintPageStyles(config) {
221
222
  }
222
223
 
223
224
  .print-page {
225
+ margin: 0 !important;
226
+ box-shadow: none !important;
224
227
  page-break-after: always;
225
- margin-bottom: 0 !important;
226
- box-shadow: none; /* 移除阴影 */
227
228
  }
228
229
 
229
230
  .print-page:last-child {
@@ -250,7 +251,7 @@ function generatePrintPageStyles(config) {
250
251
  * 用于 PrintSDK 的 printMultiple
251
252
  */
252
253
  function generateBatchPrintStyles(config) {
253
- const { pageWidthMm, pageHeightMm, isContinuous = false, minHeightMm = 100, } = config;
254
+ const { pageWidthMm, pageHeightMm, marginTop = 0, marginRight = 0, marginBottom = 0, marginLeft = 0, isContinuous = false, minHeightMm = 100, } = config;
254
255
  return `
255
256
  * { margin: 0; padding: 0; box-sizing: border-box; }
256
257
  body { margin: 0; padding: 0; background: #f5f5f5; }
@@ -261,8 +262,8 @@ function generateBatchPrintStyles(config) {
261
262
  }
262
263
 
263
264
  @media print {
264
- body { margin: 0; padding: 0; background: white; }
265
- .print-page { margin: 0; page-break-after: always; box-shadow: none !important; }
265
+ body { margin: 0 !important; padding: 0 !important; background: white !important; }
266
+ .print-page { margin: 0 !important; page-break-after: always; box-shadow: none !important; }
266
267
  .print-page:last-child { page-break-after: auto; }
267
268
  }
268
269
 
@@ -273,7 +274,7 @@ function generateBatchPrintStyles(config) {
273
274
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
274
275
  }
275
276
  }
276
-
277
+
277
278
  .print-page {
278
279
  width: ${pageWidthMm}mm;
279
280
  height: ${isContinuous ? 'auto' : pageHeightMm + 'mm'};
@@ -281,6 +282,7 @@ function generateBatchPrintStyles(config) {
281
282
  background: white;
282
283
  position: relative;
283
284
  box-sizing: border-box;
285
+ padding: ${marginTop}mm ${marginRight}mm ${marginBottom}mm ${marginLeft}mm;
284
286
  }
285
287
 
286
288
  ${generateComponentStyles()}