Forum Discussion
EhiagheBraimah
3 months agoCommunity Member
Calling all Articulate JavaScript buffs
Hi I have been trying to get a PDF to download using JavaScript, but I ran into the following errors: 1. ) Failed to load resource: net::ERR_FILE_NOT_FOUND PDFen.pdf:1 ...
JohnCooper-be3c
2 months agoCommunity Member
In your code:
const { PDFDocument } = PDFLib;
const formUrl = 'PDFen.pdf';
const formPdfBytes = await fetch(formUrl).then (res => res.arrayBuffer());
const pdfDoc = await PDFDocument.load(formPdfBytes);
const form = pdfDoc.getForm();
alert ("Helb");
You are attempting to open an existing pdf form template file "PDFen.pdf" and read the contents into a byte array. You are then using pdf-lib routines to read the pdf template from the byte array and create a new pdf form "form".
Your error message " Failed to load resource: net::ERR_FILE_NOT_FOUND PDFen.pdf:1" indicates that your JavaScript code cannot find the pdf form template file.