You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a script in nodejs to generate some PDF files. Each page must have a barcode, so I'm using symbology to generate the barcode in the SVG format and add it to each PDF page.
This is working ok, so far, but now I had to generate a large number of pages.
I need to run 3000 times, but the app crashes every time at iteration 509/510.
I isolated the code and simply running the function that returns the barcode SVG string make the app crash.
This seems to happen if the output is SVG. If the output is set to PNG the app runs all the iterations that I tested (1000 / 2000 and 3000).
/**
* Returns an SVG string of a CODE39 barcode.
* @param value string: barcode value.
* @returns
*/
const getBarCode = async (value:string):Promise<string> =>
{
try
{
const { data } = await createStream
(
{
symbology: SymbologyType.CODE39,
showHumanReadableText: true,
height: 190,
scale: 1
},
value,
OutputType.SVG
);
return data;
}
catch (error)
{
throw error;
}
}
/**
* Render a number of pages corresponding to totalPages number.
* @param totalPages: number total pages to render
*/
const generatePages = async (totalPages:number) =>
{
console.time('Time Rendering');
try
{
const pages = [...Array(totalPages).keys()].map(page => (page + 1).toString().padStart(4, '0'));
for (const [index, value] of pages.entries())
{
console.log('Barcode to page: ', value);
await getBarCode(value);
}
console.timeEnd('Time Rendering');
}
catch (error)
{
throw error;
}
}
//Starts to generate n pages
generatePages(1000);
I'm using node v16.14.0 and the latest version of this lib: v3.0.8
The text was updated successfully, but these errors were encountered:
I just encountered the same problem with node v16.16.0 and the latest version of this lib: v3.0.8. Using PNG output instead of SVG output solves the crash.
This changes the output of EPS and SVG data to write to a string buffer
instead of a file buffer. This fixes the issue where the binary would
crash after a substantial number of iterations.
This changes the output of EPS and SVG data to write to a string buffer
instead of a file buffer. This fixes the issue where the binary would
crash after a substantial number of iterations.
This changes the output of EPS and SVG data to write to a string buffer
instead of a file buffer. This fixes the issue where the binary would
crash after a substantial number of iterations.
I have a script in nodejs to generate some PDF files. Each page must have a barcode, so I'm using symbology to generate the barcode in the SVG format and add it to each PDF page.
This is working ok, so far, but now I had to generate a large number of pages.
I need to run 3000 times, but the app crashes every time at iteration 509/510.
I isolated the code and simply running the function that returns the barcode SVG string make the app crash.
This seems to happen if the output is SVG. If the output is set to PNG the app runs all the iterations that I tested (1000 / 2000 and 3000).
I'm using node v16.14.0 and the latest version of this lib: v3.0.8
The text was updated successfully, but these errors were encountered: