react-vector-pdf 0.3.3 → 0.3.5
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/README.md +25 -0
- package/dist/components/PdfPreview.d.ts +11 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/core/PdfRenderer.d.ts +4 -0
- package/dist/demo/DemoPdfDocument.d.ts +6 -0
- package/dist/react-vector-pdf.es.js +438 -371
- package/dist/react-vector-pdf.umd.js +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -61,6 +61,31 @@ const MyPdf = () => {
|
|
|
61
61
|
};
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
63:
|
|
65
|
+
64: ## Previewing
|
|
66
|
+
65:
|
|
67
|
+
66: You can embed a live preview of the PDF using the `PdfPreview` component. This component renders an `iframe` containing the generated PDF blob.
|
|
68
|
+
67:
|
|
69
|
+
68: `tsx
|
|
70
|
+
69: import { PdfPreview, PdfText } from "react-vector-pdf";
|
|
71
|
+
70:
|
|
72
|
+
71: <PdfPreview width="100%" height={600} options={{ ... }}>
|
|
73
|
+
72: <PdfText>I am visible in the preview!</PdfText>
|
|
74
|
+
73: </PdfPreview>
|
|
75
|
+
74: `
|
|
76
|
+
75:
|
|
77
|
+
76: **Props:**
|
|
78
|
+
77:
|
|
79
|
+
78: - All `PdfDocument` props (`options`, `metadata`, `pageNumbers`, `centerLabel`, etc.) are supported and passed through.
|
|
80
|
+
79: - `width` (string | number): Width of the container (default "100%").
|
|
81
|
+
80: - `height` (string | number): Height of the container (default "100%").
|
|
82
|
+
81: - `className` / `style`: Styling for the wrapper div.
|
|
83
|
+
82: - `iframeClassName` / `iframeStyle`: Styling for the internal iframe.
|
|
84
|
+
83:
|
|
85
|
+
84: **Note:** Changing props (like options, colors, fonts) will automatically regenerate and update the preview.
|
|
86
|
+
85:
|
|
87
|
+
86: ## Components
|
|
88
|
+
|
|
64
89
|
## Components
|
|
65
90
|
|
|
66
91
|
### 1. `PdfText`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PdfDocumentProps } from './PdfProvider';
|
|
3
|
+
export interface PdfPreviewProps extends Omit<PdfDocumentProps, "onReady" | "autoSave" | "filename"> {
|
|
4
|
+
width?: string | number;
|
|
5
|
+
height?: string | number;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
iframeClassName?: string;
|
|
9
|
+
iframeStyle?: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export declare const PdfPreview: React.FC<PdfPreviewProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { PdfBox } from './PdfBox';
|
|
2
2
|
export { PdfImage } from './PdfImage';
|
|
3
3
|
export { PdfList } from './PdfList';
|
|
4
|
+
export { PdfPreview } from './PdfPreview';
|
|
4
5
|
export { PdfDocument } from './PdfProvider';
|
|
5
6
|
export { PdfTable } from './PdfTable';
|
|
6
7
|
export { PdfText } from './PdfText';
|
|
@@ -5,6 +5,7 @@ export declare class PdfRenderer {
|
|
|
5
5
|
private pdf;
|
|
6
6
|
private pageWidth;
|
|
7
7
|
private pageHeight;
|
|
8
|
+
private options;
|
|
8
9
|
private cursorX;
|
|
9
10
|
private cursorY;
|
|
10
11
|
private contentWidth;
|
|
@@ -16,6 +17,7 @@ export declare class PdfRenderer {
|
|
|
16
17
|
private footerDrawer?;
|
|
17
18
|
private pendingTasks;
|
|
18
19
|
private opQueue;
|
|
20
|
+
private generation;
|
|
19
21
|
constructor(opts?: PDFOptions);
|
|
20
22
|
get instance(): jsPDF;
|
|
21
23
|
get width(): number;
|
|
@@ -33,6 +35,7 @@ export declare class PdfRenderer {
|
|
|
33
35
|
};
|
|
34
36
|
get baseLineHeight(): number;
|
|
35
37
|
resetFlowCursor(): void;
|
|
38
|
+
reset(): void;
|
|
36
39
|
setHeaderFooter(header?: (pdf: jsPDF, pageNum: number, pageCount: number, renderer: PdfRenderer) => void, footer?: (pdf: jsPDF, pageNum: number, pageCount: number, renderer: PdfRenderer) => void): void;
|
|
37
40
|
private applyBaseFont;
|
|
38
41
|
addPage(): void;
|
|
@@ -78,5 +81,6 @@ export declare class PdfRenderer {
|
|
|
78
81
|
keywords?: string[];
|
|
79
82
|
}): void;
|
|
80
83
|
save(filename: string): void;
|
|
84
|
+
getBlobUrl(): URL;
|
|
81
85
|
}
|
|
82
86
|
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
export interface DemoPdfContentProps {
|
|
3
|
+
tableHeaderColor: string;
|
|
4
|
+
tableStriped: boolean;
|
|
5
|
+
tableBorderWidth: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const DemoPdfContent: React.FC<DemoPdfContentProps>;
|
|
2
8
|
export interface DemoPdfProps {
|
|
3
9
|
pnEnabled: boolean;
|
|
4
10
|
pnPos: "header" | "footer";
|