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 - FlattenFormField & EasEurope char
  FAQ FAQ  Forum Search   Register Register  Login Login

FlattenFormField & EasEurope char

 Post Reply Post Reply
Author
Message
PeterAnderko View Drop Down
Beginner
Beginner


Joined: 03 Dec 20
Location: Slovakia
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote PeterAnderko Quote  Post ReplyReply Direct Link To This Post Topic: FlattenFormField & EasEurope char
    Posted: 03 Dec 20 at 12:10PM
Hi, help me please

i tried in Delphi 2010 this simply code to testing flattenformfield function


procedure TForm1.Button3Click(Sender: TObject);
var Okw,px:Integer;
begin
PDFDok:=TDebenuPDFLibrary1613.Create;
OKw:=PDFDok.UnlockKey(':-)');
if OKw<>1 then begin
   Showmessage('ERROR');
   Exit;
   end;
 PDFDok.SetPageSize('A4');
 PDFDok.SetOrigin(1);
 PDFDok.SetMeasurementUnits(0);
 PDFDok.NormalizePage(1);
 PDFDok.SetLineWidth(0.3);

PDFDok.LoadFromFile(AdresarExe+'POZ_2019.pdf','');   // this file contain formfield
PDFDok.CombineContentStreams;
PDFDok.FindFonts;

// I select formfield with index=8,  realy existing in POZ_2019.pdf
px:=8;
PDFDok.SetFormFieldValue(px,'Pľuščeňko');

PDFDok.SetNeedAppearances(1);
okw:=PDFDok.FlattenFormField(px);
if OKw<>1 then begin
   Showmessage('ERROR');
   Exit;
   end;

PDFDok.SaveToFile(ExtractFilePath(Application.exeName)+'OutPutForm.PDF');
end;


formfield is succesfully flattened 
the problem is that char ľ č ň  is replaced to space.
I tried a lot tricks and function from quickPDF - zerro effect
see picture:


Please help me someone Cry


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: 03 Dec 20 at 7:33PM
Hi Peter,

you're using FindFonts and do nothing with the result?
Seems the standard font which QuickPDF is used doesn't support unicode...
Not all fonts are able to show all characters - so you have to select the right one ;-)
Here's a link to a thread from a user who had the same prob with greek characters:
http://www.quickpdf.org/forum/filling-form-fields-with-greek-letters_topic2207.html

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
PeterAnderko View Drop Down
Beginner
Beginner


Joined: 03 Dec 20
Location: Slovakia
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote PeterAnderko Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 20 at 7:44AM
Hi Ingo,

tahnks for your response.

I upgrade my testing program with AddTrueTypeSubsettedFon:


procedure TForm1.Button3Click(Sender: TObject);
var Okw,px,fid,ffid:Integer;
begin
PDFDok:=TDebenuPDFLibrary1613.Create;
OKw:=PDFDok.UnlockKey(':-');
if OKw<>1 then begin
   Showmessage('ERROR');
   Exit;
   end;
 PDFDok.SetPageSize('A4');
 PDFDok.SetOrigin(1);
 PDFDok.SetMeasurementUnits(0);
 PDFDok.NormalizePage(1);
 PDFDok.SetLineWidth(0.3);

PDFDok.LoadFromFile(AdresarExe+'POZ_2019.pdf','');   // this file contains form fields
PDFDok.CombineContentStreams;

text:='ABCČDĎEÉFGHIÍJKLĽĹMNŇOÓÔPQRSŠTŤUÚVXYÝZŽabcčdďeéfghiíjklľĺmnňoóôpqrsštťuúvxyýyž1234567890-+.,;()" /\$&*@';
fid:=PDFDok.AddTrueTypeSubsettedFont('Aral77', text, 0);
PDFDok.SelectFont(fid);
ffid:=PDFDok.AddFormFont(fid);

// I select formfield with index=8,  realy existing in POZ_2019.pdf
px:=8;
PDFDok.SetFormFieldFont(px,ffid);
PDFDok.SetFormFieldValue(px,'Pľuščeňko');

PDFDok.SetNeedAppearances(1);
okw:=PDFDok.FlattenFormField(px);
if OKw<>1 then begin
   Showmessage('ERROR');
   PDFDok.Free;
   Exit;
   end;

PDFDok.SaveToFile(ExtractFilePath(Application.exeName)+'OutPutForm.PDF');
PDFDok.Free;
end;



This upgrade is one of the tricks I tried before I wrote here.
For the form field, they will keep the characters I need, but the "SetFormFieldFont" command will change the original font for the formfield.

In the original font, a special character spacing is set, which I need to fill in the form correctly.
Is it possible to achieve in some way that I set the character spacing for this formfield?
As the command does "DrawSpacedText"

thank you for answer. Thumbs Up





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: 05 Dec 20 at 3:53PM
the font is really named "Aral77"? ;-)

Cheers,
Ingo

Back to Top
PeterAnderko View Drop Down
Beginner
Beginner


Joined: 03 Dec 20
Location: Slovakia
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote PeterAnderko Quote  Post ReplyReply Direct Link To This Post Posted: 06 Dec 20 at 4:18PM
This is a really inspiring question

The font name is OK.
But I thought about why you were asking me that.
I read the description of the AddTrueTypeSubsettedFont command again.
I found that this font is not installed in Windows \ fonts.

I did a procedure where I selected this font from my form using the "SaveFontToFile" command. I installed that font file in Windows and then I ran my original test program,
but it didn't help.Confused

Then I modified the "AddTrueTypeSubsettedFont" command as follows:
 
fid: = PDFDok.AddTrueTypeSubsettedFont ('Aral77', text, 2);

It worked.Smile

My formfield has preserved the letters č ľ ť ň ... and also maintains the spacing between the letters.

However, this has the disadvantage that I have to ensure that the appropriate font is installed in the program.


Peter.




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 (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 06 Dec 20 at 11:10PM
"...However, this has the disadvantage that I have to ensure that the appropriate font is installed in the program...." which you can check before by an individual routine. To check which fonts are installed on a system isn't a big prob...

Cheers,
Ingo

Back to Top
PeterAnderko View Drop Down
Beginner
Beginner


Joined: 03 Dec 20
Location: Slovakia
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote PeterAnderko Quote  Post ReplyReply Direct Link To This Post Posted: 07 Dec 20 at 9:11AM
Yes, it's not complicated anymore.
If anyone later reads this thread, let them learn.

For example:


Function IsInstaledFont(MenoFontx:String):boolean;
begin
Result:=Screen.Fonts.IndexOf(MenoFontx)>= 0;
end;


Procedure InstalTTF(CestaMenox:PWideChar);
begin
AddFontResource(CestaMenox);
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
end;

Procedure UnInstalTTF(CestaMenox:PWideChar);
begin
RemoveFontResource(CestaMenox);
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
end;

thank you Ingo for moving me forwardThumbs Up
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: 07 Dec 20 at 8:19PM
Hi Peter :)

Thanks a lot - this will help other guys coming around here...

Cheers,
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