Skip to content

Commit

Permalink
Documentation generation first steps
Browse files Browse the repository at this point in the history
  • Loading branch information
gologames committed Nov 27, 2019
1 parent c5a361f commit be50909
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doc_generator/lib_docgenerator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var doc = require("surveyjs-doc-generator");
var ts = require("typescript");
var doc = require('surveyjs-doc-generator');
var ts = require('typescript');

doc.generateDocumentation(process.argv.slice(2), {
target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"test": "jest",
"testDev": "jest --watch",
"release": "standard-version --message \"Release: %s\" ",
"doc_gen": "node doc_generator/lib_docgenerator.js src/index.ts",
"doc_gen": "node doc_generator/lib_docgenerator.js src/entries/pdf.ts",
"doc_update": "chmod +x ./docupdate_npm.sh && ./docupdate_npm.sh",
"build_dev": "webpack --env.buildType dev --env.platform pdf",
"build_prod": "npm run build_dev && webpack --env.buildType prod --env.platform pdf && npm run dts_clean",
Expand Down
19 changes: 19 additions & 0 deletions src/event_handler/draw_canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ import { TextBrick } from '../pdf_render/pdf_text';
import { TextBoldBrick } from '../pdf_render/pdf_textbold';
import { SurveyHelper } from '../helper_survey';

/**
* Horizontal alignment types in onRenderHeader and onRenderFooter events
*/
export enum HorizontalAlign {
NotSet = 'notset',
Left = 'left',
Center = 'center',
Right = 'right'
}
/**
* Vertical alignment types in onRenderHeader and onRenderFooter events
*/
export enum VerticalAlign {
NotSet = 'notset',
Top = 'top',
Middle = 'middle',
Bottom = 'bottom'
}
/**
* Common options of rendering text and images in onRenderHeader and onRenderFooter events
*/
export interface IDrawRectOptions {
/**
* Specifies horizontal alignment of item, if set (center by default)
Expand All @@ -34,6 +43,9 @@ export interface IDrawRectOptions {
*/
rect?: IRect;
}
/**
* Options of rendering text in onRenderHeader and onRenderFooter events
*/
export interface IDrawTextOptions extends IDrawRectOptions {
/**
* String that will be drawn
Expand All @@ -48,6 +60,9 @@ export interface IDrawTextOptions extends IDrawRectOptions {
*/
isBold?: boolean;
}
/**
* Options of rendering images in onRenderHeader and onRenderFooter events
*/
export interface IDrawImageOptions extends IDrawRectOptions {
/**
* Specifies image width (used if alignment set, canvas.rect's width by default)
Expand All @@ -62,6 +77,10 @@ export interface IDrawImageOptions extends IDrawRectOptions {
*/
base64: string;
}

/**
* DrawCanvas object passed to onRenderHeader and onRenderFooter events
*/
export class DrawCanvas {
public static readonly DEFAULT_FONT_SIZE: number = 14;
public constructor(protected packs: IPdfBrick[],
Expand Down
3 changes: 3 additions & 0 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { DrawCanvas } from './event_handler/draw_canvas';
import { AdornersOptions } from './event_handler/adorners';
import { SurveyHelper } from './helper_survey';

/**
* SurveyPDF object contains options, events and methods to export PDF
*/
export class SurveyPDF extends SurveyModel {
private _haveCommercialLicense: boolean;
public options: IDocOptions;
Expand Down

0 comments on commit be50909

Please sign in to comment.