

We received a request from a client, to automate the creation of Serial Numbers inside a PDF file.
The PDF was a A3+ format and was designed in such a way to be used by a professional printer.
The serial number would start from 100,001 and would end to 150,000. The serial number needed to be printed under an exiting logo image.
The PDF template had to stay intact as it’s dimensions were set for the specific printer, which would print and then cut the logo and the serial number as a label.
We received a one page template in PDF format which we wrote in it and then duplicate it to create the final PDF.
We used C# and iTextSharp Library.
See below for a screenshot of the last page of the PDF. Page number was 447. The PDF was close to 8MB and it took less than 10 seconds to be created.
We used library version 5.5.*
https://www.nuget.org/packages/iTextSharp/
See below for a part of the code on how to write on the existing PDF:
using iTextSharp.text;
using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
.
.
.
for (int Rowi = 0; Rowi < 8; Rowi++)
{
for (int Columni = 0; Columni < 14; Columni++)
{
text = String.Format("{0:n0}", startCounter).Replace(NumberFormatInfo.CurrentInfo.NumberGroupSeparator, " ");
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text, ArrX[Columni], ArrY[Rowi], 0);
startCounter++;
if (startCounter > endCounter) break;
}
If you have a similar need for automating a large number of documents, please use our Contacts Form, we would love to help!
Check our free app that automates the creation of QR Codes: Synergy QR Code Maker
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
GET INSTANT ACCESS TO YOUR FREE GIFT
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE 30 DAYS TRIAL
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE GIFT
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE GIFT
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE E-BOOK
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE E-BOOK
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE E-BOOK
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE E-BOOK
ENTER YOUR EMAIL & DOWNLOAD
GET INSTANT ACCESS TO YOUR FREE GIFT
ENTER YOUR EMAIL & DOWNLOAD