Showing Stylish Dynamic Information Using PdfMake

I'm currently working on generating a PDF using PdfMake directly on the client side. My array of skills looks like this:

var skills: ["hiking", "running", "typing", "etc"];

I want to display these skills as tags, with styling similar to Stack Overflow (with border radius and background color):

https://i.sstatic.net/8tYEK.png

However, PdfMake doesn't seem to have any built-in functions for achieving this. Does anyone know how I can showcase an array with styled tags using PdfMake?

Answer №1

What do you think of this example?

var hobbies = ["painting", "dancing", "swimming", "etc"];
for (i=0; i<hobbies.length; i++) {
  document.write("<a class='interest'>"+hobbies[i]+"</a>");
}
a.interest {
  background: blue;
  padding: 5px 10px;
  color: white;
  font-family: serif;
  font-size: 12px;
  border-radius: 5px;
  margin-right: 2px;
  }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular is encountering a circular dependency while trying to access a property called 'lineno' that does not actually exist within the module exports

I am working on an Angular project and using the Vex template. My project utilizes Angular 9 and Node.js v15.2.0. Every time I run the project with the command ng serve -o, it displays a warning message. https://i.stack.imgur.com/8O9c1.png What could b ...

Each time Angular 6 makes a server call, it consistently retrieves the same API data until the application is refreshed

I'm currently working on developing a dashboard for a Skype bot where I need to request data every 10 seconds. The issue I'm facing is that I keep getting the same data from the API each time, but upon refreshing the app, I receive updated data f ...

Executing an asynchronous function within a TypeScript decorator

Apologies in advance for the lengthy question. I am striving to provide a clear explanation of the issue I am currently encountering. During the development of my decorators utilities library, I came across an unexpected behavior while working on one spec ...

Utilizing jQuery to add a class to an element when a different one is hovered above

I'm currently working on implementing effects on the edges of a webpage that will be triggered when a central div is hovered over. The main tool I'm using for this task is jQuery. Despite my efforts to diagnose the issue by using alerts in my Ja ...

Inject an html <img> tag using an AJAX PHP call

Greetings everyone, I am currently in the process of developing a captcha maker using PHP with an Object-Oriented Programming (OOP) approach. The implementation involves a Captcha class responsible for generating the captcha image. You can find the complet ...

Despite being installed, the message 'concurrently: command not found' pops up

I'm attempting to run two scripts simultaneously, and I came across the concurrently package that is supposed to assist with this. After executing npm install concurrently --save and verifying it in my package.json, I faced an issue when trying to run ...

Having trouble with a file-type npm module returning null even when called with a buffer - can anyone provide insight on what mistake I

I'm currently working on a website that allows users to upload video files for storage in MongoDB. Prior to uploading and storing the files, I want to validate the file's mimetype. I attempted to use the file-type npm module, but unfortunately, i ...

Classes for defining specific breakpoints in Bootstrap's grid system

Is it possible to create a Bootstrap class that applies specifically to certain breakpoints? I am aware of classes like col-sm-2 col-md-4, but I am looking for something that allows me to set the width of an element. Currently, to set the width to 100%, ...

What is the process for setting a cookie in Next.js from a different backend server?

I have encountered an issue with my Node.js API built using Express.js. The cookie I set works perfectly fine on Postman, but for some reason, it is not functioning properly in Next.js. I set the cookie when a user logs in, but it is not appearing in the b ...

Aligned to the left margin within a container located inside a 6-column Bootstrap division

I currently have two 6 column bootstrap divs positioned side by side within a row div. Both divs contain an image, with each image spanning half the width of the viewport. In the left column, above the image (set as a background via CSS), I want to place a ...

Is there a way to transform a fixed parameter into a user input value and display the function's outcome on a different page?

I am in the process of developing a straightforward web application for book searching based on ISBN. The website will feature a text input field for entering an ISBN and a submit button. Essentially, a user can enter an ISBN in the designated box, click s ...

Hover Effect with CSS Selector - JavaScript or jQuery Implementation

I have a similar code snippet: <article class="leading-0"> <h2> <a href="link">link title</a> </h2> <ul class="actions"> <li class="print-icon"> <a ...><img...>& ...

Could you provide some advice for creating a Single Page website?

I am working on a simple HTML setup with various elements such as a navbar and content blocks. <html> <head> <title>My HTML5 App</title> <meta charset="UTF-8"> <meta name="viewport" content="wid ...

Populate an array with user input values and shuffle the content for random display

I am currently encountering a challenge. I am aiming to design a form that gathers 4 nicknames after submitting the form, and then exhibits them randomly in HTML code using JavaScript My 4 input values are stored in an array. I need to display them random ...

"The Ajax function for replacing a div upon change event is not functioning properly

I am having an issue with my select box using the onchange event, <select class="form-control" onchange="getval(this.value,'<?php echo $prd->pr_id;?>','ajax<?php echo $key?>','<?php echo $key ?>')"&g ...

Here's a unique version of the text: "Learn how to customize a datepicker to display only the next 3 months as a dropdown starting from the current date. Once the current

How can I limit the date picker to show only 3 months as a dropdown starting from the current date? $(function() { $("#date").datepicker({ hideIfNoPrevNext: true, minDate: '0M', maxDate: '+90D' }); }); <link rel="s ...

Steps to modify the border style upon clicking expand or collapse functionality

I'm working on a button that should expand when clicked, remove the bottom border, and then restore the bottom border upon collapsing. I've created a function to handle this behavior, where each click increments a counter. The goal is to show the ...

What could be causing the unexpected behavior of the foreach loop?

After receiving a json response from the server, my goal is to map it to an observable array and display the results in an HTML table. The string I'm getting from the server looks like this: {"ids":[1,2,3,4],"names":["1","2","test tracker","test1"]," ...

Updating information in Angular when a route event occurs

Looking to dynamically change content in one component based on route events in Angular? Imagine having three components: "nav.component", "about.component", and "service.component". You want the text displayed in "nav.component" to be different when swi ...

Children divs unexpectedly showing up outside of their parent divs

I have reviewed similar questions on this matter, but none of them seem to provide a solution for the issue I am facing. Currently, my goal is to display a stylized list, but I am encountering more difficulties than expected. You can find a fiddle linked ...