Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix margins type of TableConfig #3351

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

talitadzikzlasu
Copy link

config.margins in TableConfig takes Object with margin values for left, top, bottom, and width
http:https://raw.githack.com/MrRio/jsPDF/master/docs/module-cell.html#~table

Thanks for contributing to jsPDF! Please follow our
Contribution Guidelines
when creating a pull request.

config.margins in TableConfig	takes  Object with margin values for left, top, bottom, and width
http:https://raw.githack.com/MrRio/jsPDF/master/docs/module-cell.html#~table
types/index.d.ts Outdated
@@ -607,7 +607,7 @@ declare module "jspdf" {
export interface TableConfig {
printHeaders?: boolean;
autoSize?: boolean;
margins?: number;
margins?: : {top?: number, left?: number, width?: number, bottom?: number};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I think width should be right.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking the code i saw that it is also called margins.width and margins.right... but not sure if it is used 🤔

var NO_MARGINS = { left: 0, top: 0, bottom: 0, right: 0 };

this.internal.__cell__.margins = Object.assign({}, NO_MARGINS);
this.internal.__cell__.margins.width = this.getPageWidth();

jsPDF/src/modules/cell.js

Lines 403 to 405 in 2d9a919

margins =
config.margins ||
Object.assign({ width: this.getPageWidth() }, NO_MARGINS),

EstebanFuentealba added a commit to EstebanFuentealba/jsPDF that referenced this pull request Apr 5, 2022
config.margins in TableConfig takes Object with margin values for left, top, right, and bottom (modified parallax#3351)
http:https://raw.githack.com/MrRio/jsPDF/master/docs/module-cell.html#~table
Add "right" to mergins in TableConfig interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants