Bulk Serial Number Printing Memory Issue

Hello,

I need some guidance, I have successfully printed serial numbers from the purchase invoice, but when there is large number of products like 1900 serial numbers the print generation kills my browsers by overflowing memory, can someone guide how I optimize my code?

{% for row in doc.items %}
{% set serial_ids_list = row.serial_no.split(“\n”) %}
{% for obj in serial_ids_list %}

            {{row.item_name}}
     Price:
  {{ frappe.db.get_value("Item Price", {"item_code": row.item_code, "price_list": "Standard Selling"}, "price_list_rate" ) }} PKR
       <svg class="barcode"
		jsbarcode-margin="0"
		jsbarcode-margintop="0"
		jsbarcode-marginbottom="0"
		jsbarcode-height="25"
		jsbarcode-width="1"
		jsbarcode-fontsize="10"
		jsbarcode-flat="true"
		jsbarcode-value="{{obj}}"/></svg></br>
		
		 <script src="/assets/frappe/js/lib/JsBarcode.all.min.js">
		</script>
		 <script>JsBarcode(".barcode").init();</script>
		 <br>

{% endfor %}

{% endfor %}

My guess is browser is not able to handle so many at an instance. Try small number group like 500 each time.

Browser tends to crash while handling large volume.

How can you please help ? I cannot figure out :frowning: