Questions tagged [pdf-lib.js]

40 questions
2
votes
0 answers

PDF-LIB ignoring "Arbitrary Mask" Adobe PDF Field

We are using this library https://pdf-lib.js.org/ to generate PDFs from our application. For one field on the PDF, I have set a special format for "Arbitrary Mask" that works when I copy the file and manually file it. However, it is ignored by the…
1
vote
2 answers

Use PDF.JS to Fill out a PDF Form

I have what seems like it should be a simple problem - I would like to be able to fill out PDF forms programmatically in javascript. My first attempt was with pdf-lib which has a nice API for filling out forms - however, the form I am trying to fill…
Tim
  • 1,013
  • 1
  • 10
  • 16
1
vote
1 answer

Fill pdf form using react

I have this form standard form of lease and i need to fill this with dynamic values using javascript. I tried using pdf-lib to get all the fields but it gives me empty array with some warning Trying to parse invalid object: in console. const…
1
vote
1 answer

Draw image in a PDF with a certain DPI

I am trying to draw an image in a pdf with PDF-Lib. My purpose is to draw it in full size in a page of 6cm x 11.3cm. I made the math conversion, if i want 300 DPI, it correspond to 780px x 1406px. I made an image with these exact dimensions, and try…
Foxhunt
  • 764
  • 1
  • 9
  • 23
1
vote
0 answers

Why i cannot add png image to pdf using pdf-lib?

I tried to add png image in nest.js using pdf-lib import { PDFDocument } from 'pdf-lib'; import * as fs from 'fs'; const existingPdf = await fs.readFileSync( './agreements/1431993ded73f6a0be5653a3e3fc680f.pdf', ); const pdfDoc = await…
1
vote
0 answers

How do I rename the field names using pdflib?

The names for the pdf fields currently are hard to know where each field is on the form and what's what so I wanted to either change the name of some of the fields that don't make sense or make the field names show up on the form so I know where to…
Harshitha
  • 11
  • 1
1
vote
1 answer

PDF-Lib Modify PDF Downloadable

Currently implementing the PDF-Lib Library for my project to modify PDFs Source: https://pdf-lib.js.org/#examples And it is working very well, but the modified PDFs are saved on the server. I am searching for the opportunity that the pdfs which…
JrWebDev
  • 128
  • 9
1
vote
0 answers

Restrict number of pages on a PDF shown in browser Node server

I am developing a platform with model preview before paying to download for pdf's my problem is how to restrict the number of pages of pdf showing to the user. eg. I use pdfjs to render the pdf on canvas but when I see the network request the full…
Natnael
  • 17
  • 7
1
vote
0 answers

Editing PDF in nodejs - problem with xref

I got a pdf, where I have to put some datas inside (like addresses and images). At the end, I need to sign it with a certificate (so, if I opened it with a reader, I got the sidebar with the info about that sign and about that PDF hasn't been…
Andrea Mason
  • 239
  • 1
  • 2
  • 14
1
vote
1 answer

Convert an absolute location (top and left) in HTML to a location in PDF

Context: I render a pdf into a canvas at its original size using PDF.js, I also made the container of the canvas the same size as the canvas, and without border. At some location [top, left], I position a text element with absolute positioning…
Fego
  • 145
  • 1
  • 7
1
vote
1 answer

Rotate a page with pdf-lib and javascript

I am making a website that can modify pdf files , and I was trying to be able to rotate a page or multiple pages but couldn't find how to do that in their docs . const pdfDoc = await loadSingleFile(inputFiles[0]) // An input pdf file const…
Chakib Salah
  • 499
  • 1
  • 10
0
votes
1 answer

How can I use UTF-8 on PDF-Lib JavaScript

i'm trying to make a js project that fills pdf forms. Well it works only with english characters. How can I make it to use UTF-8? This is my code: const formUrl = 'form.pdf'; const formPdfBytes = await fetch(formUrl).then((res) =>…
Nick S
  • 1
  • 3
0
votes
0 answers

Detect blank page in PDF in NodeJS using pdf-lib

I spent the day trying to find a way on my NodeJS server to detect whenever the last page of a generated pdf is blank (to remove it). I just can't seem to find a way to do so. I tried to use pdf-lib and many others along the way, with no success.…
Axel Carré
  • 145
  • 1
  • 8
0
votes
2 answers

How to change Font style and font family in PDF-Lib NodeJS for only one text Field

I am trying to change the font style and font family for the signature field in my PDF using PDF-Lib library in nodejs.Here is my code , but I am unable to change the font. const {PDFDocument, degrees, rgb, StandardFonts} =…
0
votes
2 answers

Did the transpiler get it wrong?

I'm using the pdf-lib package in a TypeScript project and wrote some wrapper code to use it in test automation. It worked fine. We decided to push this wrapper code to a shared project so others could use it too, but then the test breaks. After…
Kevin McDowell
  • 532
  • 6
  • 20
1
2 3