ilovepdf-nodejs icon indicating copy to clipboard operation
ilovepdf-nodejs copied to clipboard

Filename is not respected for signature file

Open nealoke opened this issue 2 years ago • 2 comments

According to the documentation you can specify a filename but in the emails that I'm receiving I still see the unwanted name example document-clkqrgexd0001c0s5a7yu23ln.pdf in stead of example document.pdf

const task = instance.newTask('sign') as SignTask;
await task.start();

// File
const signFile = await task.addFile('.../example document-clkqrgexd0001c0s5a7yu23ln.pdf');
const signatureFile = new SignatureFile(
	{
		filename: 'example document.pdf',
		serverFilename: signFile.serverFilename,
		taskId: signFile.taskId,
		params: signFile.params,
	},
	[
		{
			type: 'signature',
			position: '0 0',
			pages: '1',
			size: 28,
		},
	],
);

// Signer
const signer = new Signer(company.name, '[email protected]');
signer.addFile(signatureFile);
task.addReceiver(signer);

// Branding
const brandLogo = await task.addFile(logo.url);
await task.process({
	uuid_visible: true,
	brand_logo: brandLogo.serverFilename,
	brand_name: company.name,
	language: 'nl',
	expiration_days: 30,
	signer_reminder_days_cycle: 3,
	certified: true,
});

Example in email image

nealoke avatar Aug 05 '23 04:08 nealoke

Too bad you closed this ticket without providing an answer. As a developer and SaaS I think this isn't a great library to work with. Some persistent issues and missing essential features... 😓

nealoke avatar Apr 14 '24 13:04 nealoke

Hi @nealoke !

Sorry for the inconvenience. We had an error tracking this issue but we are currently working on it.

For the moment, I will reopen it and we will reply when the fix is released.

Diego.

diego-ilovepdf avatar Apr 22 '24 08:04 diego-ilovepdf

Hi @nealoke ,

sorry about the late response. There you have a code that allows you to change the filename correctly.

Looks like the "filename" is autocompleted when sending the request according to the information contained on "SignTask", which contains the BaseFile information of that uploaded object. This is why passing a BaseObject does not actually change that value when sending the request.

Please find a code that helps you to change the filename:

const task = instance.newTask('sign') as SignTask;
await task.start();
const file = await task.addFile("https://pdfobject.com/pdf/sample.pdf");
file.filename = "example.pdf"
      
const signatureFile = new SignatureFile(file, [{
      type: 'signature',
      position: '300 -100',
      pages: '1',
      size: 28,
}]);
      
      
const signer = new Signer('name', 'someemail');
signer.addFile(signatureFile);
task.addReceiver(signer);
const processResponse = await task.process();
console.log(processResponse);

Let me know if that worked for you, for now, I'm going to close the issue, if you tell me otherwise, I'll reopen it.

guillem-pdf avatar Apr 30 '24 09:04 guillem-pdf