Barcode to PDF problem

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Barcode to PDF problem

Postby Bronius » February 26th, 2009, 2:33 pm

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
Attachments
Project1.zip
Sample project
(4.02 KiB) Downloaded 100 times
Bronius
Active Member
Active Member
 
Posts: 11
Joined: August 26th, 2005, 12:16 pm

Re: Barcode to PDF problem

Postby Kambiz » February 26th, 2009, 8:53 pm

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.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Barcode to PDF problem

Postby Bronius » March 2nd, 2009, 6:19 am

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
Last edited by Bronius on March 7th, 2009, 7:57 am, edited 1 time in total.
Bronius
Active Member
Active Member
 
Posts: 11
Joined: August 26th, 2005, 12:16 pm

Re: Barcode to PDF problem

Postby Kambiz » March 2nd, 2009, 7:31 am

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;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Barcode to PDF problem

Postby Bronius » March 7th, 2009, 7:52 am

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
Bronius
Active Member
Active Member
 
Posts: 11
Joined: August 26th, 2005, 12:16 pm

Re: Barcode to PDF problem

Postby Kambiz » March 7th, 2009, 8:07 am

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.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron