141
questions
1
vote
1
answer
52
views
pdfkit-table doesn't add new page, writes over same text on page one
I am new with PDFKit for generate a server-side PDF with node-js, I also am using pdfkit-table for better table creation inside the PDF. My code creates a pdf with 4 tables when the size of the first ...
0
votes
0
answers
10
views
pdfkit breaks the file if process.exit is call after doc.end()
This is something I can't understand and I would like to ask you all, giving this code:
async function processCodes() {
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream(`ordine_${ordine}....
0
votes
0
answers
26
views
Center Text URLs in PDFKit
I am trying to build a PDF using PDFKit and am struggling with some alignment issues
I have
Option 1
Option 2
Option 3
and I would like it to look like this
Option 1 | Option 2 ...
0
votes
0
answers
70
views
Cloud function: doc.pipe(fs.createWriteStream("output.pdf")) doesn't work with api request
I am using google cloud functions to run an api with node js. I am using pdfkit to create a pdf.
When I run node index.js (in the terminal) manually. The pdf gets generated. When I do the api request ...
0
votes
0
answers
35
views
How to send an existing .pdf (not a blank page) by nodemailer and pdfkit in node
hello I have a problem because I cannot send a pdf as an attachment via nodemailer. The PDF is sent, but upon receipt it is a blank page. I use node and express.
My function is used to do lead ...
0
votes
0
answers
46
views
Node.js pdfkit download issue, file gets downloaded after showing error
router.get('/generate-profile-doc/:id', async (req, res, next) => {
try {
const characterId = parseInt(req.params.id);
const character = await rickAndMortyService.getCharacter(...
1
vote
0
answers
310
views
I need the value of my headers turns into a specific color if the value of it it's out of range
I'm using pdfkit-table in nestjs and im currently having troubles with my project where i need that the value of the field 'temperature' that comes from my db, turns of a specific color if the value ...
1
vote
1
answer
894
views
How to print pdf in nodejs
I'm using pdfkit and ipp library for printing a pdf to a network printer (Brother HL-L2360D series).
Here is the code
const ipp = require('ipp');
const concat = require('concat-stream');
const ...
0
votes
1
answer
255
views
Image in pdfkit not displaying?
I am using pdfkit to generate a pdf file in Node JS, but I am having trouble to display an image. The image is in the same folder as my Node javascript file, but it keeps telling me "no such file ...
1
vote
0
answers
188
views
NodeJS Express PdfKit image issue
Hey all the issue i am having is I have an array of image urls and what i am trying to do is loop the images and add the image to the pdfkit document.
the urls of the images are valid and it works ...
0
votes
1
answer
1k
views
How to align two paragraphs to the left and right on the same line in PdfKit?
I am trying to achieve having two texts on the same line on the left and right sides. An image of the expected result is shown below
I tried to do the following but the result is not correct
doc.font(...
0
votes
0
answers
174
views
pdfkit - firebase functions - node 16
I have currently 10 working functions in my firebase:functions. Now I try to create a pdf inside a rtdb-trigger-function. The problem is, as soon as I require pdfkit:
const pdfkit = require('pdfkit');
...
0
votes
0
answers
427
views
How to make formcheckbox checked and disabled dynamically?
I have multiple checkboxes now I want to make one of them checked dynamically and it's not clickable (readonly) using the PDFkit.
Here is what I have tried so far.
// create a document and pipe to a ...
1
vote
1
answer
1k
views
PDFkit : how to create text over rectangle like material ui textfield look?
I am learning PDFkit I am playing with a demo now I want to create a rectangle with text inside which looks like a material UI texfield.
The Expected results:
So far here is what I have.
var doc = ...
3
votes
1
answer
1k
views
Render HTML data while generating PDF using PDFkit in nodejs
I need to generate a PDF file using 'PDFkit' library. Data is retreived from MySQL DB, some of the data contains HTML content. while rendering HTML data to PDF using 'html-to-text' library some of the ...
2
votes
1
answer
206
views
Using pdfkit, how do I add a Lock dictionary to PDF?
It has taken me some time to figure out, but I have successfully added a signature field to a PDF generated with pdfkit. I add the field with the following function:
const formSig = ((pdfDoc, name, x, ...
0
votes
1
answer
2k
views
How to send a html code as a arguement of function in PDFKIT node modules to generate its pdf?
When I do .text(<some text material>) then PDFKIT shows this given text in a PDF. This is my code:
const doc = new PDFDocument();
// pipe the document to a blob
const stream = doc.pipe(...
0
votes
1
answer
177
views
npm pdfkittable ENOENT for reading file from locally in EC2
My Express App Ending up in the following error while running code of pdfkittable in AWS EC2, but it was working fine in my local system
.
Error: ENOENT: no such file or directory, open './images/145....
0
votes
0
answers
291
views
How to create pdf from huge dataset of mongodb data about 10million data rows
I want to create pdf from huge dataset of mongodb. (about 10million rows)
No specific format of data. you can assume employee database
Iam using MEAN stack(open to new tech if applicable)
Approches ...
1
vote
1
answer
495
views
Unable to send pdf attachment with more than 2 photos using sendgrid
I have one weird problem. I created API, that allow you to: Upload photos to server, then save data to database, generate pdf with these datas and photos and then send email with that pdf attachment. ...
1
vote
0
answers
609
views
Node.js How to add wkhtmltopdf result to PDFKit page?
Is there a way to concat the result of an an html page converted with wkhtmltopdf-node inside a document page created with pdfkit in node.js, instead of just creating a pdf file from html?
const doc = ...
1
vote
3
answers
1k
views
PDFkit (Node): How to create paragraph indents?
I'm trying to create paragraph indents in PDFkit. The PDFkit docs state that the indent attribute is "to indent each paragraph of text". While trying this, only the first line has an indent.
...
1
vote
1
answer
873
views
pdfkit doc.text showing "Ð" in newline (\n) in nodejs
I am using pdfkit to create invoice in pdf.
When I tried to add newline/nextline (\n) in a string which I tried to add using doc.text("Text \n new line"); it shows Ð and then adds newline.
...
0
votes
1
answer
2k
views
PDFkit new page changes content position
I am fully aware that my problem most likely has something to do with me doing something wrong, but I can't seem to figure it out. Here is my code:
for (let i = 0; i < formContentArray.length; i++) ...
0
votes
1
answer
1k
views
Can I change the default path folder when generate pdf using pdfkit?
I have done generate PDF using pdfkit in node js, but the pdf is downloaded in the default folder download in my computer. Can I change the path of folder from node js, not from setting in my computer?...
0
votes
1
answer
1k
views
PDFKit: How to display generated PDF in browser?
Newbie here. How do I display a pdf generated by PDFKit in another tab using React? I tried following the instructions on their docs but the file is being saved locally -- which is not what I would ...
0
votes
1
answer
811
views
How to pass req.body from router file to module?
I'm trying to separate my code into modules so the main files (app and router) stay relatively neat. The webpage accepts a POST from form and returns the user a PDF generated with user input.
In ...
0
votes
1
answer
892
views
Custom font in Firebase Cloud function for creating a PDF
I am trying to use PDFKit in Firebase cloud functions to create a pdf with 1 line of text a custom font. I have created the folder 'fonts' and added the ttf to it. Only I constantly get this error in ...
0
votes
1
answer
384
views
Why in pdfkit, a string starts a new paragraph and a new page
I'm using pdfKit and I'm drawing some lines and text on a single page. It works nice, but if I wrote the text near the border the string is cut off and a new page is created!
Here the code:
const ...
2
votes
0
answers
469
views
Express.js and PDFKit: saving as file works, stream produces empty file
I am trying to create a PDF on a server with express.js and PDFKit. If I save the PDF as a file, it works as expected. However, if I try to send the content to the browser as a stream, I get a PDF, ...
0
votes
3
answers
2k
views
Node.js - How to write variable file names
I'd like to run an SVG-PDF-converter, which processes all files in a folder and creates the PDF output files with the corresponding file names:
var fs = require('fs'),
PDFDocument = require('...
0
votes
1
answer
1k
views
PDFKit JS image grows bigger when placed in PDF
I have an image (a strange image, but the marks in the corner just help me determine where the corners are):
However when I create a PDF using PDFKit, I get this (a print preview of the A5 PDF it ...
2
votes
2
answers
2k
views
Why is nodeJs not reading entire binary file from disk?
I have a PDF file which I want to read into memory using NodeJS. Ideally I'd like to encode it using base64 for transferring it. But somehow the read function does not seem to read the full PDF file, ...
0
votes
1
answer
1k
views
Large Html file to PDF
I wanted to convert a large html file(21 Mb excluding photos) to .pdf but I wasn't able to do that
Solution in Javascript or python or even a CLI will work
I tried two methods:
using html-node
...
0
votes
1
answer
364
views
How to integrate google map into pdf using PDFKit
I'm using nodejs as backend technology. I'm sending a email by attaching a pdf. I'm using to pdfkit to generate pdf (https://www.npmjs.com/package/pdfkit ). How can i display google map image ...
1
vote
1
answer
1k
views
Convert svg data into pdf using SVGtoPDF (SVG-to-PDFKit)
I am using SVGtoPDF npm library to get svg element on pdf but for following svg object it is not working as <image> tag is creating problem.
ERROR Message:: SVGElemImage: failed to open image &...
3
votes
1
answer
4k
views
Feeding PDF generated from pdfkit as input to pdf-lib for merging
I am trying to send a pdfkit generated pdf file as input to pdflib for merging. I am using async function. My project is being developed using sails Js version:"^1.2.3", "node": &...
1
vote
0
answers
3k
views
how to generate horizontal line in pdfkit as per content length exceed
const { createInvoice } = require("./createInvoice.js");
const invoice = {
shipping: {
name: "John Doe",
address: "1234 Main Street",
city: "San ...
0
votes
1
answer
116
views
PDFToolKit is sending weird data
I have installed PDFKit for node.js. When i call my method to download a PDF file, i get this kind of characers on my browser:
xœU»nÜ0ìùüËûâ’Œ+8Ò¹.H‘œOn|Eà¿ï!ï> AÔ’”†ÃåÌŠ#áºa4Χð+ðÕ؇ýe£ªMfç)av
...
0
votes
1
answer
4k
views
How to download pdf with pdfkit in node
Good morning, I wanted to be able to open the pdf after generating it.
Or download it.
I tried several ways but I couldn't.
I'll leave a bit of my code below.
I'm using node for backend and react for ...
1
vote
0
answers
1k
views
File type unknown (application/octet-stream) is not supported, Sendgrid node js file unable to read
hi guys thank you for your time i have this issues where i generate pdf file using pdfkit and send them using sendgrid in node js, the email was successfully send but the file seems to be corrupt when ...
0
votes
2
answers
2k
views
pdfkit nodejs, one element per page from page 2
Im using pdfkit to generate pdf invoice.
When all my content fit in one page I have no issue.
However when it doesn't fit and need an extra page, I have a strange behaviour:
Instead of adding the ...
0
votes
1
answer
2k
views
Node Js NPM PDFkit and Voilab pdf table, pdfkit paragraph error afer generate table
Hi guys thank you for stopping by
i have issues with voilab pdf kit a library for PDFkit which essentially helps for arranging the table for NPM Pdfkit.
after successfully generating table, i tried ...
-1
votes
1
answer
3k
views
how to put multiple images to pdf using pdfkit (node js)?
what i wanted is paste multiple images from multilpe url.
to do so im downloading and one by one appending to pdf
but the problem is code is not synchronous. And I'm new to node / javascript.
here is ...
0
votes
1
answer
350
views
Pdfkit output is garbled
On my node project, I wanted to run np audit. This required a new version of npm. Upon running the audit, I then needed to update a lot of npm modules, and also upgraded node from 6.92 to 12.3.1.
My ...
1
vote
1
answer
149
views
pdfkit can possible to used image tag?
I have a question about using pdfkit is capable to attached base64 image in doc.image of PDFkit?
usually in PDFkit doc.image can be attached image/sample.jpeg.
doc.image('images/test.jpeg', 320, 145, {...
1
vote
0
answers
138
views
Node and PDFKit - how to separate PDF generation business logic from router
I am working on a web app using Express and Node.js. The api router currently has a GET method generatePDF to generate a PDF with PDFKit library.
'use strict';
var express = require('express');
var ...
7
votes
4
answers
20k
views
ExpressJS and PDFKit - generate a PDF in memory and send to client for download
In my api router, there is a function called generatePDF which aims to use PDFKit module to generate a PDF file in memory and send to client for download instead of displaying only.
In api.js:
var ...
0
votes
1
answer
690
views
Javascript accessing a child array using it in PDFKit - NODE JS
I am using pdfKit in a nodeJS project - to generate PDF's.
I have an array where data is stored and used to populate a table, which is working.
However I cannot seam to figure out how to retrieve ...
2
votes
1
answer
2k
views
Using PDFKit to store a PDF in S3 on the fly
I'm trying to create a pdf of some images (in datauri format) is nodejs and having the pdf stored in my S3. The return of the function is expected to provide the s3 URL of the file.
I'm using parse-...