survey-pdf 2.4.0 → 2.5.0

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.
@@ -92,26 +92,17 @@ export declare class SurveyHelper {
92
92
  } & ITextFieldBrickOptions): Promise<IPdfBrick>;
93
93
  static inBrowser: boolean;
94
94
  static get hasDocument(): boolean;
95
- static getImageBase64(imageLink: string): Promise<string>;
96
- static shouldConvertImageToPng: boolean;
97
- static getImageLink(controller: DocController, imageOptions: {
95
+ static createImageFlat(point: IPoint, question: any, controller: DocController, options: {
98
96
  link: string;
99
97
  width: number;
100
98
  height: number;
101
- objectFit?: string;
102
- }, applyImageFit: boolean): Promise<string>;
103
- static createImageFlat(point: IPoint, question: any, controller: DocController, imageOptions: {
104
- link: string;
105
- width: number;
106
- height: number;
107
- objectFit?: string;
99
+ objectFit?: 'cover' | 'contain' | 'fill';
108
100
  }, applyImageFit?: boolean): Promise<IPdfBrick>;
109
101
  static canPreviewImage(question: QuestionFileModel, item: {
110
102
  name: string;
111
103
  type: string;
112
104
  content: string;
113
105
  }, url: string): boolean;
114
- static getImageSize(url: string): Promise<ISize>;
115
106
  static createRowlineFlat(point: IPoint, controller: DocController, width?: number, color?: string): IPdfBrick;
116
107
  static createLinkFlat(point: IPoint, question: Question, controller: DocController, text: string, link: string): Promise<IPdfBrick>;
117
108
  static createAcroformRect(rect: IRect): number[];
@@ -147,4 +138,5 @@ export declare class SurveyHelper {
147
138
  defaultImageWidth?: any;
148
139
  defaultImageHeight?: any;
149
140
  }): Promise<ISize>;
141
+ static clear(): void;
150
142
  }
@@ -1,11 +1,13 @@
1
1
  import { IQuestion } from 'survey-core';
2
2
  import { PdfBrick } from './pdf_brick';
3
- import { DocController } from '../doc_controller';
4
- import { IPoint } from '../entries/pdf';
3
+ import { DocController, IPoint } from '../doc_controller';
5
4
  export declare class ImageBrick extends PdfBrick {
6
- protected image: string;
7
- protected originalWidth: number;
8
- protected originalHeight: number;
9
- constructor(question: IQuestion, controller: DocController, image: string, point: IPoint, originalWidth: number, originalHeight: number);
5
+ protected image: string | Uint8Array;
6
+ protected targetWidth: number;
7
+ protected targetHeight: number;
8
+ protected imageWidth?: number;
9
+ protected imageHeight?: number;
10
+ protected imageId?: string;
11
+ constructor(question: IQuestion, controller: DocController, image: string | Uint8Array, point: IPoint, targetWidth: number, targetHeight: number, imageWidth?: number, imageHeight?: number, imageId?: string);
10
12
  renderInteractive(): Promise<void>;
11
13
  }
@@ -0,0 +1,6 @@
1
+ import { BaseImageUtils, IImageInfo, IImageUtils } from '.';
2
+ export declare class ImageUtils extends BaseImageUtils implements IImageUtils {
3
+ protected _getImageInfo(url: string): Promise<IImageInfo>;
4
+ private getCoverCanvasOptions;
5
+ applyImageFit(imageInfo: IImageInfo, imageFit: 'cover' | 'fill' | 'contain', targetWidth: number, targetHeight: number): Promise<IImageInfo>;
6
+ }
@@ -0,0 +1,23 @@
1
+ export interface IImageInfo {
2
+ imageData: string | Uint8Array<ArrayBuffer>;
3
+ width: number;
4
+ imageId?: string;
5
+ height: number;
6
+ }
7
+ export interface IImageUtils {
8
+ getImageInfo(url: string): Promise<IImageInfo>;
9
+ applyImageFit(imageInfo: IImageInfo, imageFit: 'cover' | 'fill' | 'contain', targetWidth: number, targetHeight: number): Promise<IImageInfo>;
10
+ clear(): void;
11
+ }
12
+ export declare class BaseImageUtils implements IImageUtils {
13
+ private hash;
14
+ private imageId;
15
+ protected getImageId(): string;
16
+ protected _getImageInfo(url: string): Promise<IImageInfo>;
17
+ getImageInfo(url: string): Promise<IImageInfo>;
18
+ applyImageFit(imageInfo: IImageInfo, imageFit: 'cover' | 'fill' | 'contain', targetWidth: number, targetHeight: number): Promise<IImageInfo>;
19
+ protected get emptyImage(): IImageInfo;
20
+ clear(): void;
21
+ }
22
+ export declare function getImageUtils(): IImageUtils;
23
+ export declare function registerImageUtils(val: IImageUtils): void;
@@ -0,0 +1,4 @@
1
+ import { IImageInfo, IImageUtils, BaseImageUtils } from '.';
2
+ export declare class ImageUtils extends BaseImageUtils implements IImageUtils {
3
+ protected _getImageInfo(url: string): Promise<IImageInfo>;
4
+ }