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!
FlattenFormField & EasEurope char |
Post Reply |
Author | |
PeterAnderko
Beginner Joined: 03 Dec 20 Location: Slovakia Status: Offline Points: 10 |
Post Options
Thanks(0)
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
PeterAnderko
Beginner Joined: 03 Dec 20 Location: Slovakia Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
the font is really named "Aral77"? ;-)
|
|
Cheers,
Ingo |
|
PeterAnderko
Beginner Joined: 03 Dec 20 Location: Slovakia Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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. Then I modified the "AddTrueTypeSubsettedFont" command as follows: fid: = PDFDok.AddTrueTypeSubsettedFont ('Aral77', text, 2); It worked. 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. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
"...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 |
|
PeterAnderko
Beginner Joined: 03 Dec 20 Location: Slovakia Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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 forward
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Peter :)
Thanks a lot - this will help other guys coming around here... Cheers, Ingo |
|
Cheers,
Ingo |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store