Page 1 of 1
Barcode to PDF problem

Posted:
February 26th, 2009, 2:33 pm
by Bronius
Hello,
I'm using D6, Preview 4.75, dsPDF.dll (May 3, 2007) and free barcode fonts fb_code128_large.ttf and fb_code128_medium.ttf.
I can create texts and barcodes on PrintPreview, but I receive error "Cannot recieve data from font", when I'm trying save Preview to PDF.
Can anybody say solution of this problem ?
Thanks,
------------------------------------
Bronius
Re: Barcode to PDF problem

Posted:
February 26th, 2009, 8:53 pm
by Kambiz
I get an exception instead of that message.
You may get a solution by contacting the author of dsPDF. And, please if you found the answer, share it with us.
Re: Barcode to PDF problem

Posted:
March 2nd, 2009, 6:19 am
by Bronius
Author say's, that pdf must save data of the font. To save data of the font, function GetFontData is called. But this function returns GDI_ERROR .
May be, it's a font problem? Any suggestions more?

Bronius
Re: Barcode to PDF problem

Posted:
March 2nd, 2009, 7:31 am
by Kambiz
I check it out and the GetFontData API works properly on both barcode fonts.
Here is my code:
- Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap: TBitmap;
BufferSize: DWORD;
Buffer: Pointer;
begin
Bitmap := TBitmap.Create;
try
Bitmap.Canvas.Font.Name := 'fb_code128_large';
BufferSize := GetFontData(Bitmap.Canvas.Handle, 0, 0, nil, 0);
if BufferSize <> GDI_ERROR then
begin
GetMem(Buffer, BufferSize);
try
if GetFontData(Bitmap.Canvas.Handle, 0, 0, Buffer, BufferSize) <> GDI_ERROR then
// font's data is in the buffer
else
RaiseLastOSError;
finally
FreeMem(Buffer, BufferSize);
end;
end
else
RaiseLastOSError;
finally
Bitmap.Free;
end;
end;
Re: Barcode to PDF problem

Posted:
March 7th, 2009, 7:52 am
by Bronius
I have received new version of dsPDF.dll (March 4, 2009) from author, and there are no more problems for me while saving PrintPreview with barcode fonts to PDF.
Great thanks to Grega Loboda and Kambiz.
--------------------------------------------------
Bronius
Re: Barcode to PDF problem

Posted:
March 7th, 2009, 8:07 am
by Kambiz
That was good news.
I tried to get the new demo version to include it in PrintPreview, but the demo is still the old one.