Skip to content

Instantly share code, notes, and snippets.

@sepsol
Last active August 15, 2023 18:55
Show Gist options
  • Save sepsol/a7753af67560ae894c7f03e602eb18ba to your computer and use it in GitHub Desktop.
Save sepsol/a7753af67560ae894c7f03e602eb18ba to your computer and use it in GitHub Desktop.

JavaScript Node.js Developer Needed for Adding 'Snaking Columns' Feature to pdfmake NPM Package

Introduction:

We're searching for an experienced developer to work on a 1-2 weeks project, aiming to enhance the open-source pdfmake NPM package by adding a feature.

Problem Statement:

The pdfmake package currently lacks support for a snaking columns feature as highlighted in longstanding issue #604.

In the current implementation, when a pdfmake document definition object for a document has 2 columns and you add a lengthy table in the first page's first column, instead of overflowing to the next column on the same page (green arrow in the attached screenshot), it overflows to the next page's first column (red arrow in the attached screenshot).

Screenshot

Problem Showcase

This is not the desired behavior. Instead, we aim for the table to continue from the 1st column of the 1st page to the 2nd column of the same page, then to the 1st column of the 2nd page, and so forth.

To get a hands-on understanding, you can experiment with this issue on pdfmake's playground using the attached document definition sample.

Sample Document Definition
var dd = {
    content: [
        {
            columns: [
                {
                    table: {
                        widths: ['*', '*'],
                        headerRows: 1,
                        body: [
                            ['Col1', 'Col2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                            ['1', '2'],
                        ],
                    },
                },
                {
                    table: {
                        widths: ['*', '*'],
                        body: [
                            ['Col3', 'Col4'],
                            ['3', '4'],
                            ['3', '4'],
                        ],
                    },
                },
            ],
        },
    ],
};

Objective:

Your main task is to implement the "snaking columns" feature in pdfmake. We value implementations that are cohesive and align with the package's existing API. Once you've crafted the feature, you're encouraged to submit a PR and receive full credit for your contribution. In fact, your solution must be something that can close the aforementioned issue and be mergeable into the package.

Your solution must not modify the example or any input data directly. Instead, it must extend the package's core API and functionality to work with any valid pdfmake input (table, text, etc.) dynamically. Your implementation must be inspired by how the pdfmake package internally handles content overflow from one page to another, and extend and add the option to apply the same logic across columns as described.

To let me know that you've made it this far in the job description, please include the full open date of the mentioned issue in your proposal.

Required Experience:

  • Proficiency in old JavaScript ES5 syntax.
  • Strong grasp of JavaScript inheritance using prototypes.
  • Understanding of object-oriented programming.
  • Familiarity with Node.js fs (FileSystem) module and PDF file manipulation.
  • Experience in crafting Node.js NPM packages is beneficial.
  • Previous interaction with pdfmake or its dependency pdfkit would be advantageous.
  • Contributions to open-source projects are a big plus.
  • Must be adept with Git source control.
  • Ideally, you should have at least 1 year of programming experience.

We look forward to collaborating with talented individuals. If you believe you're the right fit, please apply by reaching out to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment