Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Problem with setting formfieldfont
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with setting formfieldfont

 Post Reply Post Reply
Author
Message
Josef Gschwendtner View Drop Down
Beginner
Beginner


Joined: 23 Mar 16
Location: Germany
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Josef Gschwendtner Quote  Post ReplyReply Direct Link To This Post Topic: Problem with setting formfieldfont
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store