Skip to content

A wrapper VS Code workspace around the proprietary fork of the public pdfmake repository with debugger configuration.

Notifications You must be signed in to change notification settings

MyBestHomecare/pdfmake-workspace

Repository files navigation

pdfmake-workspace

Development

Preparing the environment

  1. Clone the workspace repository along with its submodule repository:
    git clone --recurse-submodules [email protected]:MyBestHomecare/pdfmake-workspace.git
  2. Open the project in VS Code:
    code pdfmake-workspace
  3. Install the recommended workspace extensions. To install, you can also run the following in the ctrl/cmd + P menu:
    ext install ritwickdey.liveserver esbenp.prettier-vscode effectful.debugger
    
  4. Open up a terminal in the workspace directory and install the node dependencies:
    npm install

Running the code

  1. From the workspace directoy, navigate to the src/ directory and modify the index.js file or any of the document definitions inside src/docDefinition. You can also create local-only docDefinitions by creating files that end in .local.js. So for example you could have: src/docDefinition/myTest.local.js. Keep in mind that the .local.js files will be ignored by git.

    You can use the official pdfmake playground and its documentation to familiarize yourself with the docDefinition syntax.

    From here you have 2 options:

    1. Using the NPM script (easier):

    1. In the workspace directory, simply run:
      npm start

    2. Using the Live Server extension (preferred):

    1. To quickly generate a PDF document, in the workspace directory run:
      npm run code:quick
      Alternatively, to keep a node server running that watches for changes, run:
      npm run code:watch
    2. Finally, click on the "Go Live" button from the status bar. Alternatively, open the command pallette (ctrl/cmd + shift + P) and type:
      Live Server: Open With Live Server
      
      This requires the Live Server extension to be installed. The PDF viewer will be running on localhost:8080 by default. This endpoint is rendering the out/index.html file which opens the last generated PDF file (out/last.pdf). The configuration for the live server exists in .vscode/settings.json. To manually see a history of previously generated PDFs, navigate to out/history.

Debugging the code

  1. Either use the Custom (Basic) or the Custom (Effectful) configurations. The latter is preferred as it allows stepping back as well as stepping forward. It requires the Effectful extension to be installed. After the code execution is finished, the resulting PDF file can be accessed either via the live server or via navigating to the out/ directory.

About

A wrapper VS Code workspace around the proprietary fork of the public pdfmake repository with debugger configuration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published