Print Page | Close Window

Problem with Fonts

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=799
Printed Date: 12 May 24 at 6:27PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with Fonts
Posted By: hkoestner
Subject: Problem with Fonts
Date Posted: 08 Oct 07 at 10:06AM
Hi all,

I want to replace the Font of the Formfields on my Form.

The Code is:

QP := TiSEDQuickPDF.Create;
QP.UnlockKey('Key');
Pfad := ExtractFilePath(Application.Exename);
OpenDialog1.InitialDir := Pfad + 'Forms\';
try
    if OpenDialog1.Execute then begin
      Test := QP.LoadFromFile(OpenDialog1.FileName);
      Test := QP.AddStandardFont(8);
      Test := QP.SaveToFile(OpenDialog1.FileName);
      Test := QP.LoadFromFile(OpenDialog1.FileName);
      for I := 1 to QP.FormFieldCount do begin
        Test := QP.SetFormFieldFont(i, 3)
      end;
    end;
    Test := QP.SaveToFile(OpenDialog1.FileName);
except
end;

The original document has 2 Fonts. After adding the new font and saving the document ther are correct 3 Fonts embedded. The update from the formfieldfont faild, when i use the font number 2 then i become Wingdings, although Wingdings is not in the embedded fonts contained or when i use font number 3 (what was correct) the font dont change.

Can help any one?



Replies:
Posted By: hkoestner
Date Posted: 11 Oct 07 at 10:22AM
Hi

nobody any idea??

Horst


Posted By: ukobsa
Date Posted: 11 Oct 07 at 3:39PM
Hi Horst,

unfortunatly not. Can you give a sample pdf? You can send it to: support@quickpdf.org

best regards,
Uli


Posted By: marian_pascalau
Date Posted: 18 Oct 07 at 9:05AM
Hi there,
I believe I was not meant when you send the test file but because I am also behind the support email address I have an answer for you :-)
 
You wrote something like this:
 
    Test  := Pdf.AddStandardFont(8);
    for i := 1 to Pdf.FormFieldCount do
        Test := Pdf.SetFormFieldFont(i, 3);
 
And I write something different:
 
    hFont  := Pdf.AddStandardFont(8);
    ASSERT(hFont  <> 0); 
        // this function add a new font to PDF Contents and Dictionaries.
        // The return is kind of Handle for Font !!!
    idFont := Pdf.AddFormFont(hFont);
    ASSERT(idFont <> 0); 
        // this function make Font available for FormFields !!! 
        // The return value is the ID of your FormFieldFont !!!
        // Only now you can use this ID in your program
        // (in your case it should have value 3)
    for nIndex := 1 to Pdf.FormFieldCount do
    begin
        Test := Pdf.SetFormFieldFont(nIndex, idFont);
        ASSERT(Test = 1);
 
        { do the rest of your job }
    end;
If this works then please pay more attention on the types of return codes and use variable names depending on their purpose. This makes your program more visible and will avoid missunderstandings by default.
 
Best regards, Marian


Posted By: hkoestner
Date Posted: 18 Oct 07 at 10:01AM
Hi Marian,

it works great.

Thanks for your help
Horst


Posted By: marian_pascalau
Date Posted: 18 Oct 07 at 11:59AM
You are welcome :-)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk