Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Tmlewin .
14
Views
3
Comments
automatically generating barcodes on pdf's
Question
hi everyone ,wow i am really amazed with lots of impressive stuff that has been done so far in this community and i think i have some catching up to do.well, i am currently working on an e -registration portal and i am trying to implement a function ,after a candidate fil the registration form and onclick of the submit buton two things happen submition of info to database(which i ve already done) and secondly it pops the canndidate info in a pop up screen in pdf format and automatically assign/genrate a barcode to the candidate.i have been worlking with the htmltopdf component have managed to do the conversion to pdf but i can automatically generate barcode labels on pdf.i have written a piece of code in visual studio for it /its working but i cant get it to work on the agile platform.here is a code snippet :
string sWorkPath = "";
sWorkPath = this.Context.Server.MapPath("");
// Get the Requested code to be created.
string Code = Request["code"].ToString();
// Multiply the lenght of the code by 40 (just to have enough width)
int w = Code.Length * 40;
// int w = Code.Length * 25;
// Create a bitmap object of the width that we calculated and height of 100
Bitmap oBitmap = new Bitmap(w, 100);
// then create a Graphic object for the bitmap we just created.
Graphics oGraphics = Graphics.FromImage(oBitmap);
// Now create a Font object for the Barcode Font
// (in this case the IDAutomationHC39M) of 18 point size
//Font oFont = new Font("IDAutomationHC39M_FREE.otf", 18);
PrivateFontCollection fnts = new PrivateFontCollection();
fnts.AddFontFile(sWorkPath + @"\IDAutomationHC39M.ttf");
FontFamily fntfam = new FontFamily("IDAutomationHC39M", fnts);
Font oFont = new Font(fntfam, 18);
//Font oFont = new Font(fntfam, 16);
// Let's create the Point and Brushes for the barcode
PointF oPoint = new PointF(2f, 2f);
SolidBrush oBrushWrite = new SolidBrush(Color.Black);
SolidBrush oBrush = new SolidBrush(Color.White);
// Now lets create the actual barcode image
// with a rectangle filled with white color
oGraphics.FillRectangle(oBrush, 0, 0, w , 100);
// We have to put prefix and sufix of an asterisk (*),
// in order to be a valid barcode
oGraphics.DrawString("*" + Code + "*", oFont, oBrushWrite, oPoint);
// Then we send the Graphics with the actual barcode
Response.ContentType = "image/jpeg";
oBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
any help will be appreciated
André Pereira
Hello Tmlewin,
Why don´t you use the ITextSharp to generate the PDF with the barcode. This library is free and has many barcode generator types.
Link with an example of creating a PDF with multiple Barcodes.
https://blog.rubypdf.com/itextsharp/tutorial01/ap09Chap0907.cs.html
Best Regards,
André Pereira
Joop Stringer
Have you visited Googles dynamic QR-tag generator tools
https://code.google.com/intl/nl-NL/apis/chart/infographics/docs/qr_codes.html
(This generatesQR Tag images)
I've used this in an MS-Word mailmerge document but can also be used in webpages or any other way
or
ZXing generator
https://zxing.appspot.com/generator/
Tmlewin .
thank you all for your help.have just downloaded(have been kind of busy,sorry 4 the late reply)itext.will keep you guys posted on how it goes
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...