diff --git a/apps/core/src/layouts/workspace-layout.tsx b/apps/core/src/layouts/workspace-layout.tsx index 97978f8190..faeeb3794c 100644 --- a/apps/core/src/layouts/workspace-layout.tsx +++ b/apps/core/src/layouts/workspace-layout.tsx @@ -1,5 +1,4 @@ import { Content, displayFlex } from '@affine/component'; -import { AffineWatermark } from '@affine/component/affine-watermark'; import { appSidebarResizingAtom } from '@affine/component/app-sidebar'; import { BlockHubWrapper } from '@affine/component/block-hub'; import { NotificationCenter } from '@affine/component/notification-center'; @@ -260,7 +259,6 @@ export const WorkspaceLayoutInner: FC = ({ children }) => { - diff --git a/apps/electron/src/main/export/pdf.ts b/apps/electron/src/main/export/pdf.ts index 98f6b730f1..29d2959a3a 100644 --- a/apps/electron/src/main/export/pdf.ts +++ b/apps/electron/src/main/export/pdf.ts @@ -40,16 +40,15 @@ export async function savePDFFileAs( await BrowserWindow.getFocusedWindow() ?.webContents.printToPDF({ - margins: { - marginType: 'custom', - top: 0, - bottom: 0, - left: 0, - right: 0, - }, pageSize: 'A4', + margins: { + bottom: 0.5, + }, printBackground: true, landscape: false, + displayHeaderFooter: true, + headerTemplate: '
', + footerTemplate: getFootTemple(), }) .then(data => { fs.writeFile(filePath, data, error => { @@ -65,3 +64,27 @@ export async function savePDFFileAs( }; } } + +function getFootTemple(): string { + const logo = ` + + + + + + + + + `; + + const footerTemp = ` + + `; + + return footerTemp; +} diff --git a/packages/component/src/components/affine-watermark/index.css.ts b/packages/component/src/components/affine-watermark/index.css.ts deleted file mode 100644 index cc71ae1624..0000000000 --- a/packages/component/src/components/affine-watermark/index.css.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { style } from '@vanilla-extract/css'; - -export const waterMarkStyle = style({ - display: 'none', - '@media': { - print: { - position: 'fixed', - bottom: '0', - right: '20px', - zIndex: 100, - display: 'block', - width: 'auto', - filter: 'opacity(20%)', - }, - }, -}); - -export const linkStyle = style({ - textAlign: 'left', - color: 'black', - display: 'flex', - flexDirection: 'row', - justifyContent: 'flex-end', - alignItems: 'center', - width: '200px', -}); -export const linkTextStyle = style({ - whiteSpace: 'nowrap', -}); -export const iconStyle = style({ - fontSize: '20px', -}); diff --git a/packages/component/src/components/affine-watermark/index.tsx b/packages/component/src/components/affine-watermark/index.tsx deleted file mode 100644 index 680aa5b250..0000000000 --- a/packages/component/src/components/affine-watermark/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import clsx from 'clsx'; - -import { linkStyle, linkTextStyle, waterMarkStyle } from './index.css'; -import { AffineLogoIcon } from './logo'; - -export const AffineWatermark = () => { - const t = useAFFiNEI18N(); - return ( - - ); -}; diff --git a/packages/component/src/components/affine-watermark/logo.tsx b/packages/component/src/components/affine-watermark/logo.tsx deleted file mode 100644 index a6bbd7afaf..0000000000 --- a/packages/component/src/components/affine-watermark/logo.tsx +++ /dev/null @@ -1,22 +0,0 @@ -export const AffineLogoIcon = () => { - return ( - - - - - - - - - - - - ); -}; diff --git a/packages/component/src/components/workspace/index.css.ts b/packages/component/src/components/workspace/index.css.ts index 7591937f91..8dc699da2c 100644 --- a/packages/component/src/components/workspace/index.css.ts +++ b/packages/component/src/components/workspace/index.css.ts @@ -1,3 +1,4 @@ +import { lightCssVariables } from '@toeverything/theme'; import type { ComplexStyleRule } from '@vanilla-extract/css'; import { globalStyle, style } from '@vanilla-extract/css'; @@ -53,6 +54,12 @@ globalStyle(`html[data-theme="dark"] ${appStyle}`, { vars: { '--affine-noise-opacity': '0.1', }, + + '@media': { + print: { + vars: lightCssVariables, + }, + }, }); export const mainContainerStyle = style({