New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

typescript-pdf

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-pdf - npm Package Compare versions

Comparing version
0.3.0
to
0.4.0
dist/index.cjs

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+330
-327

@@ -300,51 +300,2 @@ declare class PdfStream {

interface PageOptions {
width?: number;
height?: number;
margin?: {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
orientation?: 'portrait' | 'landscape';
build?: () => unknown;
}
interface DocumentInfo {
title?: string;
author?: string;
subject?: string;
keywords?: string[];
creator?: string;
producer?: string;
}
interface PdfOptions {
info?: DocumentInfo;
compress?: number;
version?: string;
}
interface Point {
x: number;
y: number;
}
interface Size {
width: number;
height: number;
}
interface Rect {
x: number;
y: number;
width: number;
height: number;
}
interface Matrix {
a: number;
b: number;
c: number;
d: number;
e: number;
f: number;
}
declare enum FontWeight$1 {

@@ -488,2 +439,25 @@ Normal = "normal",

interface Point {
x: number;
y: number;
}
interface Size {
width: number;
height: number;
}
interface Rect {
x: number;
y: number;
width: number;
height: number;
}
interface Matrix {
a: number;
b: number;
c: number;
d: number;
e: number;
f: number;
}
interface BoxConstraints {

@@ -525,2 +499,3 @@ readonly minWidth: number;

readonly theme: ThemeData;
readonly fontRegistry?: any;
}

@@ -567,280 +542,2 @@ interface EdgeInsets {

declare enum Axis {
Horizontal = "horizontal",
Vertical = "vertical"
}
declare enum MainAxisAlignment {
Start = "start",
End = "end",
Center = "center",
SpaceBetween = "spaceBetween",
SpaceAround = "spaceAround",
SpaceEvenly = "spaceEvenly"
}
declare enum CrossAxisAlignment {
Start = "start",
End = "end",
Center = "center",
Stretch = "stretch",
Baseline = "baseline"
}
declare enum MainAxisSize {
Min = "min",
Max = "max"
}
declare enum FlexFit {
Loose = "loose",
Tight = "tight"
}
interface FlexSpacing {
mainAxisSpacing?: number;
crossAxisSpacing?: number;
}
interface FlexChildData {
flex?: number;
fit?: FlexFit;
}
interface FlexLayoutData {
mainAxisSize: number;
crossAxisSize: number;
children: Array<{
size: {
width: number;
height: number;
};
position: {
x: number;
y: number;
};
layoutResult: LayoutResult;
index: number;
}>;
}
declare const FlexUtils: {
getMainAxisSize(size: {
width: number;
height: number;
}, axis: Axis): number;
getCrossAxisSize(size: {
width: number;
height: number;
}, axis: Axis): number;
createSize(mainAxisSize: number, crossAxisSize: number, axis: Axis): {
width: number;
height: number;
};
getMainAxisConstraints(constraints: BoxConstraints, axis: Axis): {
min: number;
max: number;
};
getCrossAxisConstraints(constraints: BoxConstraints, axis: Axis): {
min: number;
max: number;
};
calculateFlexSpace(availableSpace: number, totalFlex: number, flexChildren: Array<{
flex: number;
minSize: number;
}>): Array<number>;
calculateMainAxisPositions(childSizes: number[], containerSize: number, alignment: MainAxisAlignment, spacing?: number): number[];
calculateCrossAxisPosition(childSize: number, containerSize: number, alignment: CrossAxisAlignment): number;
};
declare class Document {
private readonly pdfDocument;
constructor(options?: {
info?: DocumentInfo;
verbose?: boolean;
version?: string;
});
addPage(options?: PageOptions): Page$1;
save(): Promise<Uint8Array>;
}
declare class Page$1 {
private readonly pdfPage;
private readonly pdfDocument;
constructor(pdfPage: PdfPage, pdfDocument: PdfDocument);
getGraphics(): PdfGraphics;
drawText(text: string, x: number, y: number, options?: {
fontSize?: number;
font?: PdfStandardFont;
color?: {
red: number;
green: number;
blue: number;
};
}): void;
drawRect(x: number, y: number, width: number, height: number, options?: {
fill?: boolean;
stroke?: boolean;
color?: {
red: number;
green: number;
blue: number;
};
lineWidth?: number;
}): void;
}
declare class Page {
constructor();
}
declare enum FontWeight {
Thin = 100,
ExtraLight = 200,
Light = 300,
Normal = 400,
Medium = 500,
SemiBold = 600,
Bold = 700,
ExtraBold = 800,
Black = 900
}
declare enum FontStyle {
Normal = "normal",
Italic = "italic",
Oblique = "oblique"
}
interface FontDescriptor {
family: string;
weight: FontWeight | 'normal' | 'bold';
style: FontStyle | 'normal' | 'italic';
}
interface FontFallbackRule {
pattern: RegExp | string;
fallbacks: PdfStandardFont[];
weightMapping?: Record<string, PdfStandardFont>;
}
declare enum FontCategory {
Serif = "serif",
SansSerif = "sans-serif",
Monospace = "monospace",
Cursive = "cursive",
Fantasy = "fantasy"
}
declare class FontFallbackSystem {
private fallbackRules;
private genericFallbacks;
constructor();
private initializeDefaultRules;
addFallbackRule(rule: FontFallbackRule): void;
resolveFontDescriptor(descriptor: FontDescriptor): PdfStandardFont;
private categorizeFont;
private selectBestFontFromFallbacks;
private normalizeWeight;
private normalizeStyle;
private scoreFontMatch;
private getFontWeight;
private getFontStyle;
getFallbackChain(family: string): PdfStandardFont[];
isNativelySupported(family: string): boolean;
}
declare const defaultFontFallback: FontFallbackSystem;
declare const FontUtils: {
resolveFont: (family: string, weight?: "normal" | "bold", style?: "normal" | "italic") => PdfStandardFont;
resolveFontStack: (fontStack: string[]) => PdfStandardFont;
parseFontFamily: (fontFamily: string) => string[];
categorizeFont: (family: string) => FontCategory;
};
interface CharacterMetrics {
code: number;
width: number;
height: number;
leftBearing: number;
rightBearing: number;
}
interface WordMetrics {
text: string;
width: number;
height: number;
characters: CharacterMetrics[];
hyphenatable: boolean;
hyphenationPoints?: number[];
}
interface LineMetrics {
words: WordMetrics[];
width: number;
height: number;
baseline: number;
ascender: number;
descender: number;
leading: number;
justificationSpace: number;
}
interface ParagraphMetrics {
lines: LineMetrics[];
width: number;
height: number;
lineCount: number;
averageLineWidth: number;
}
interface EnhancedFontMetrics {
fontName: PdfStandardFont;
unitsPerEm: number;
ascender: number;
descender: number;
capHeight: number;
xHeight: number;
lineGap: number;
characterWidths: Map<number, number>;
kerningPairs: Map<string, number>;
}
interface TextMeasurementOptions {
fontSize: number;
font: FontDescriptor;
lineHeight: number;
letterSpacing: number;
wordSpacing: number;
kerning: boolean;
direction: 'ltr' | 'rtl';
hyphenation: {
enabled: boolean;
minWordLength: number;
minLeftChars: number;
minRightChars: number;
};
}
interface LineBreakingOptions {
maxWidth: number;
strategy: 'simple' | 'optimal' | 'balanced';
hyphenation: boolean;
hyphenationPenalty: number;
loosePenalty: number;
tightPenalty: number;
justificationThreshold: number;
}
declare class TextMetricsEngine {
private fontFallback;
private fontMetricsCache;
constructor(fontFallback?: FontFallbackSystem);
private initializeFontMetrics;
private addFontVariations;
private generateCharacterWidths;
private getBaseCharacterWidths;
private calculateCharacterWidth;
private generateKerningPairs;
measureCharacter(char: string, options: TextMeasurementOptions): CharacterMetrics;
measureWord(word: string, options: TextMeasurementOptions): WordMetrics;
private getKerning;
private findHyphenationPoints;
private canHyphenateAt;
measureLine(words: WordMetrics[], options: TextMeasurementOptions): LineMetrics;
breakIntoLines(text: string, options: TextMeasurementOptions, breakingOptions: LineBreakingOptions): LineMetrics[];
private simpleLineBreaking;
private optimalLineBreaking;
private balancedLineBreaking;
measureParagraph(text: string, options: TextMeasurementOptions, breakingOptions: LineBreakingOptions): ParagraphMetrics;
}
declare const defaultTextMetrics: TextMetricsEngine;
declare const TextMeasurementUtils: {
measureTextWidth: (text: string, fontSize: number, fontFamily?: string) => number;
calculateLineHeight: (fontSize: number, lineHeightMultiplier?: number) => number;
getTextBounds: (text: string, fontSize: number, maxWidth: number, fontFamily?: string) => {
width: number;
height: number;
lineCount: number;
};
};
interface Widget {

@@ -1080,2 +777,3 @@ layout(context: LayoutContext): LayoutResult;

private readonly decoration?;
private childLayoutResult?;
constructor(props?: ContainerProps);

@@ -1309,2 +1007,82 @@ private parseColor;

declare enum Axis {
Horizontal = "horizontal",
Vertical = "vertical"
}
declare enum MainAxisAlignment {
Start = "start",
End = "end",
Center = "center",
SpaceBetween = "spaceBetween",
SpaceAround = "spaceAround",
SpaceEvenly = "spaceEvenly"
}
declare enum CrossAxisAlignment {
Start = "start",
End = "end",
Center = "center",
Stretch = "stretch",
Baseline = "baseline"
}
declare enum MainAxisSize {
Min = "min",
Max = "max"
}
declare enum FlexFit {
Loose = "loose",
Tight = "tight"
}
interface FlexSpacing {
mainAxisSpacing?: number;
crossAxisSpacing?: number;
}
interface FlexChildData {
flex?: number;
fit?: FlexFit;
}
interface FlexLayoutData {
mainAxisSize: number;
crossAxisSize: number;
children: Array<{
size: {
width: number;
height: number;
};
position: {
x: number;
y: number;
};
layoutResult: LayoutResult;
index: number;
}>;
}
declare const FlexUtils: {
getMainAxisSize(size: {
width: number;
height: number;
}, axis: Axis): number;
getCrossAxisSize(size: {
width: number;
height: number;
}, axis: Axis): number;
createSize(mainAxisSize: number, crossAxisSize: number, axis: Axis): {
width: number;
height: number;
};
getMainAxisConstraints(constraints: BoxConstraints, axis: Axis): {
min: number;
max: number;
};
getCrossAxisConstraints(constraints: BoxConstraints, axis: Axis): {
min: number;
max: number;
};
calculateFlexSpace(availableSpace: number, totalFlex: number, flexChildren: Array<{
flex: number;
minSize: number;
}>): Array<number>;
calculateMainAxisPositions(childSizes: number[], containerSize: number, alignment: MainAxisAlignment, spacing?: number): number[];
calculateCrossAxisPosition(childSize: number, containerSize: number, alignment: CrossAxisAlignment): number;
};
interface FlexProps extends WidgetProps {

@@ -1482,2 +1260,227 @@ children: Widget[];

interface PageOptions {
width?: number;
height?: number;
margin?: {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
orientation?: 'portrait' | 'landscape';
build?: () => Widget;
}
interface DocumentInfo {
title?: string;
author?: string;
subject?: string;
keywords?: string[];
creator?: string;
producer?: string;
}
interface PdfOptions {
info?: DocumentInfo;
compress?: number;
version?: string;
}
declare class Document {
private readonly pdfDocument;
constructor(options?: {
info?: DocumentInfo;
verbose?: boolean;
version?: string;
});
addPage(options?: PageOptions): Page$1;
save(): Promise<Uint8Array>;
private renderWidgetToPage;
}
declare class Page$1 {
private readonly pdfPage;
private readonly pdfDocument;
constructor(pdfPage: PdfPage, pdfDocument: PdfDocument);
getGraphics(): PdfGraphics;
drawText(text: string, x: number, y: number, options?: {
fontSize?: number;
font?: PdfStandardFont;
color?: {
red: number;
green: number;
blue: number;
};
}): void;
drawRect(x: number, y: number, width: number, height: number, options?: {
fill?: boolean;
stroke?: boolean;
color?: {
red: number;
green: number;
blue: number;
};
lineWidth?: number;
}): void;
}
declare class Page {
constructor();
}
declare enum FontWeight {
Thin = 100,
ExtraLight = 200,
Light = 300,
Normal = 400,
Medium = 500,
SemiBold = 600,
Bold = 700,
ExtraBold = 800,
Black = 900
}
declare enum FontStyle {
Normal = "normal",
Italic = "italic",
Oblique = "oblique"
}
interface FontDescriptor {
family: string;
weight: FontWeight | 'normal' | 'bold';
style: FontStyle | 'normal' | 'italic';
}
interface FontFallbackRule {
pattern: RegExp | string;
fallbacks: PdfStandardFont[];
weightMapping?: Record<string, PdfStandardFont>;
}
declare enum FontCategory {
Serif = "serif",
SansSerif = "sans-serif",
Monospace = "monospace",
Cursive = "cursive",
Fantasy = "fantasy"
}
declare class FontFallbackSystem {
private fallbackRules;
private genericFallbacks;
constructor();
private initializeDefaultRules;
addFallbackRule(rule: FontFallbackRule): void;
resolveFontDescriptor(descriptor: FontDescriptor): PdfStandardFont;
private categorizeFont;
private selectBestFontFromFallbacks;
private normalizeWeight;
private normalizeStyle;
private scoreFontMatch;
private getFontWeight;
private getFontStyle;
getFallbackChain(family: string): PdfStandardFont[];
isNativelySupported(family: string): boolean;
}
declare const defaultFontFallback: FontFallbackSystem;
declare const FontUtils: {
resolveFont: (family: string, weight?: "normal" | "bold", style?: "normal" | "italic") => PdfStandardFont;
resolveFontStack: (fontStack: string[]) => PdfStandardFont;
parseFontFamily: (fontFamily: string) => string[];
categorizeFont: (family: string) => FontCategory;
};
interface CharacterMetrics {
code: number;
width: number;
height: number;
leftBearing: number;
rightBearing: number;
}
interface WordMetrics {
text: string;
width: number;
height: number;
characters: CharacterMetrics[];
hyphenatable: boolean;
hyphenationPoints?: number[];
}
interface LineMetrics {
words: WordMetrics[];
width: number;
height: number;
baseline: number;
ascender: number;
descender: number;
leading: number;
justificationSpace: number;
}
interface ParagraphMetrics {
lines: LineMetrics[];
width: number;
height: number;
lineCount: number;
averageLineWidth: number;
}
interface EnhancedFontMetrics {
fontName: PdfStandardFont;
unitsPerEm: number;
ascender: number;
descender: number;
capHeight: number;
xHeight: number;
lineGap: number;
characterWidths: Map<number, number>;
kerningPairs: Map<string, number>;
}
interface TextMeasurementOptions {
fontSize: number;
font: FontDescriptor;
lineHeight: number;
letterSpacing: number;
wordSpacing: number;
kerning: boolean;
direction: 'ltr' | 'rtl';
hyphenation: {
enabled: boolean;
minWordLength: number;
minLeftChars: number;
minRightChars: number;
};
}
interface LineBreakingOptions {
maxWidth: number;
strategy: 'simple' | 'optimal' | 'balanced';
hyphenation: boolean;
hyphenationPenalty: number;
loosePenalty: number;
tightPenalty: number;
justificationThreshold: number;
}
declare class TextMetricsEngine {
private fontFallback;
private fontMetricsCache;
constructor(fontFallback?: FontFallbackSystem);
private initializeFontMetrics;
private addFontVariations;
private generateCharacterWidths;
private getBaseCharacterWidths;
private calculateCharacterWidth;
private generateKerningPairs;
measureCharacter(char: string, options: TextMeasurementOptions): CharacterMetrics;
measureWord(word: string, options: TextMeasurementOptions): WordMetrics;
private getKerning;
private findHyphenationPoints;
private canHyphenateAt;
measureLine(words: WordMetrics[], options: TextMeasurementOptions): LineMetrics;
breakIntoLines(text: string, options: TextMeasurementOptions, breakingOptions: LineBreakingOptions): LineMetrics[];
private simpleLineBreaking;
private optimalLineBreaking;
private balancedLineBreaking;
measureParagraph(text: string, options: TextMeasurementOptions, breakingOptions: LineBreakingOptions): ParagraphMetrics;
}
declare const defaultTextMetrics: TextMetricsEngine;
declare const TextMeasurementUtils: {
measureTextWidth: (text: string, fontSize: number, fontFamily?: string) => number;
calculateLineHeight: (fontSize: number, lineHeightMultiplier?: number) => number;
getTextBounds: (text: string, fontSize: number, maxWidth: number, fontFamily?: string) => {
width: number;
height: number;
lineCount: number;
};
};
declare const utils: {};

@@ -1484,0 +1487,0 @@

{
"name": "typescript-pdf",
"version": "0.3.0",
"version": "0.4.0",
"description": "A modern TypeScript library for programmatic PDF generation with a declarative API",

@@ -25,3 +25,3 @@ "keywords": [

},
"main": "./dist/index.cjs.js",
"main": "./dist/index.cjs",
"module": "./dist/index.esm.js",

@@ -32,3 +32,3 @@ "types": "./dist/index.d.ts",

"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"

@@ -119,3 +119,3 @@ }

{
"path": "dist/index.cjs.js",
"path": "dist/index.cjs",
"limit": "100 KB"

@@ -122,0 +122,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display