Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

How to add barcode to each page of the pdf in the single document?

Question

I want to add barcode to each page of the pdf in the single document which is having more than one page.

Answer

To add a barcode to each page of a PDF you need to use the PageCount function to determine the number of pages in the PDF and then loop through each page and draw your barcode. Here is some sample code written in JScript:

// Load your PDF

QP.LoadFromFile("example.pdf");

// Set the origin for the co-ordinates to be
// the top left corner of the page.

QP.SetOrigin(1);

// Draw three different barcodes on each
// page in the PDF.

for (i = 1; i <=  QP.PageCount(); i++)
{
  /// Select the page to draw the barcodes on
  QP.SelectPage(i);

  // Draw the barcodes
  QP.DrawBarCode(25, 25, 150, 100, "MyBarcode256", 1, 0);
  QP.DrawBarCode(225, 50, 100, 600, "MyBarcode257/RC", 1, 0);
  QP.DrawBarCode(350, 50, 200, 150, "MyBarcode258", 3, 0);

}

// Save the new file to the output folder

QP.SaveToFile("PDF_with_Barcodes.pdf");

© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum