Taking into account that just add the functionality of generating the barcode and format PDF417 with the "Pdf417lib", follows toturial:
No need to install dpk that comes along, unless you want to implement something in design time.
First step is to add in the project’s search path ( Ctrl+Shift+F11 ) the following directories:
...\pas417lib-master\vcl
...\pas417lib-master\src
Now follow the code of the implemented classes:
Barcodegenerator - Interface
unit BarcodeGenerator;
interface
uses
Graphics;
type
IBarcodeGenerator = interface
['{BDBF2DC5-29CB-413F-9920-579D4213B638}']
function GetPdf417(AValue: String): TBitmap;
end;
implementation
end.
Barcodegeneratorimpl - Implementation
unit BarcodeGeneratorImpl;
interface
uses
Graphics, PDF417Barcode, BarcodeGenerator;
type
TBarcodeGeneratorImpl = class(TInterfacedObject, IBarcodeGenerator)
private
MyCodeBar: TPDF417BarcodeVCL;
public
constructor Create;
destructor Destroy; override;
function GetPdf417(AValue: String): TBitmap;
end;
implementation
uses
SysUtils;
{ THelperBarcodeGenerator }
constructor TBarcodeGeneratorImpl.Create;
begin
MyCodeBar := TPDF417BarcodeVCL.Create(nil);
end;
destructor TBarcodeGeneratorImpl.Destroy;
begin
FreeAndNil(MyCodeBar);
inherited;
end;
function TBarcodeGeneratorImpl.GetPdf417(AValue: String): TBitmap;
begin
MyCodeBar.Lines.Add(AValue);
Result := MyCodeBar.Bitmap;
end;
end.
Now in this example, a normal Unit was created, with the visual part, a Tedit, a Timage and a Tbutton were added.
Example of use
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
end;
var
Form2: TForm2;
implementation
uses
BarcodeGenerator, BarcodeGeneratorImpl;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
FBarcodeGenerator: IBarcodeGenerator;
begin
FBarcodeGenerator := TBarcodeGeneratorImpl.Create;
Image1.Picture.Bitmap := FBarcodeGenerator.GetPdf417(Edit1.Text);
end;
end.
I believe that with the 2 Barcodegenerator and Barcodegeneratorimpl Units, it is easy to inject this function into your framework.
Your question is a bit wide. Do you already know how to generate the code? Can you draw the code? Can you calculate the pattern? It would be important to [Dit] the question and make clear the exact doubt, with the specific difficulty it is having (preferably with the current state of the respective code).
– Bacco
A good outline of the pattern is: http://www.morovia.com/manuals/PDF417-Font-ware-Writer-SDK-4/chapter.overview.php
– Bacco
In that case, I suggest you find a specific component for barcode generation, and use it within your component. The correct thing would be for you to abandon this framework, and move on to a newer one. Never make changes to a component that is not yours, so create a base class of that component and make your edits there. Imagine if you had to update these guys today?
– Victor Tadashi
So @Victorzanella tried not to touch the component, but I have over 1000 reports generated in this generator, and many are client specific. Using a new generator is almost impossible as I would have to convetere each report and on each customer (I have tried to do but without much success).
– Andrey
@Bacco In fact the answer is no to all your questions. Hence the question a little wide. In the generator I use, only 1D barcodes are accepted.
– Andrey
In this case, I suggest you find another lib that generates the code in the desired format. Having this in hand, just implement this functionality within this current generator. Basically, you will inject an extension into what you already have today, what do you think of the idea ? If you agree we can sequence with codes.
– Victor Tadashi
@Victorzanella I fully agree, I think this is really the way out. I’ve found the lib you mentioned Pdf417lib. I’m trying to implement it within the generator, but with difficulties, it’s another standard... The report generator I use can be found in pReport. Thank you.
– Andrey
Come on, it’s just a short while before I can give you an answer. I installed this lib, and it worked perfectly. What’s been your difficulty in including this guy inside your report generator ?
– Victor Tadashi
I will try to explain the difficulty, in the report generator I can put objects on the page. When I insert a
BarCode
, I select the type (EAN13, Code39 etc), I was able to insert the PDF417. Looking at the source code of the generator, I discovered where the image is generated mounted with the barcode, and at this point I’m not getting inject the lib code you downloaded.– Andrey