Print Page | Close Window

Problem with setting formfieldfont

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=3289
Printed Date: 09 Jul 25 at 12:24PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with setting formfieldfont
Posted By: Josef Gschwendtner
Subject: Problem with setting formfieldfont
Date Posted: 23 Mar 16 at 10:15AM
Hi,
we have a problem find the right way to set the font of a formfield.
Below the code we did try:

  PDF := TDebenuPDFLibrary.Create;
  UnlockResult := PDF.UnlockKey(cDebenuLicenseKey);
  try
    if (UnlockResult = 1) then begin

      // Load Template
      PDF.LoadFromFile(ATemplate, '');

      // Set the paper size
      PDF.SetPageSize('A4');

      // Set the origin to the top-left corner
      PDF.SetOrigin(1);

      // Set the measurement units to millimetres
      PDF.SetMeasurementUnits(1);


      FontID := PDF.AddTrueTypeFont('Arial', 0);
      FieldIndex := APDF.NewFormField('LvBez', 1);

      PDF.SetFormFieldBounds(FieldIndex, ALeft, ATop, AWidth, AHeight);
      PDF.SetFormFieldPage(FieldIndex, APageNumber);

      PDF.SetFormFieldFont(FieldIndex, FontID);

      FontID := PDF.AddTrueTypeFont('Courier New', 0);
      FieldIndex := APDF.NewFormField('LvNr', 1);

      PDF.SetFormFieldBounds(FieldIndex, ALeft, ATop, AWidth, AHeight);
      PDF.SetFormFieldPage(FieldIndex, APageNumber);

      PDF.SetFormFieldFont(FieldIndex, FontID);

      // Compress the contents of the file
      PDF.CompressContent;

      // Save File
      PDF.SaveToFile(AFileName); 
    end;

  finally
    PDF.Free;
  end;

The second field should have font "Courier New" but it doesn't.

Could anybody help us to understand better how to do this.

Regards,
Josef



Replies:
Posted By: Ingo
Date Posted: 23 Mar 16 at 12:51PM
Hi Josef,

i've read inside the online reference and there i've found this:
http://www.debenu.com/docs/pdf_library_reference/AddFormFont.php
This should mean that first there's your AddTrueTypeFont... at last there's your SetFormFieldFont ... but in the middle there should be the still missing AddFormFont ;-)
Try it ... hope it helps.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo




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