EldoS | Feel safer!

Software components for data protection, secure storage and transfer

signature - encoding char : ě

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#36586
Posted: 04/28/2016 09:03:22
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Hello Dmytro, I have a similar problem like the person who started this thread (Kvetoslav Jansta).
I'm able to sign (Tiny PDF singer Delphi sample) pdf file with my custom text including special czech characters (ěščřžýáíéů), SimpleFont class and AutoAdjustEncoding = true are used.
PDF Readers: Foxit is OK, Sumatra is OK, but Adobe Reader (the most significant for me) shows an overlapped characters.
Settings of reader's zoom is unimportant, it always happens this way.

If I use a Free Serif font from "Signer/Fonts" subfolder, everything looks OK.
Unfortunately I need an Arial, so I guess I have to solve my situation with
Quote
All other encodings should be coded by hand using SimpleFont.EncodingObject.Differences property to remap a glyphs, see samples(for Type1 fonts).

Is there any example or sample how to do that? I've found only this comment but I'm not sure how to use it for my case.

Code
      // Use Differences property to remap a code to the name of any glyph description that exists in the font
      // Uncomment following line to change a Euro character (0x80 in Win-1252) to Pound Sign (Sterling)
      //SimpleFont.EncodingObject.Differences[128] := 'sterling';


Thank you for answer

Regards,
Jakub
#36587
Posted: 04/28/2016 10:07:23
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us,

Quote
I have a similar problem like the person who started this thread (Kvetoslav Jansta).
I'm able to sign (Tiny PDF singer Delphi sample) pdf file with my custom text including special czech characters (ěščřžýáíéů), SimpleFont class and AutoAdjustEncoding = true are used.

This is quite old topic. In version 13 we have significantly improved support for non-ascii characters in a signature widget when auto encoding option is used, so upgrading to newer version (if you are using older version) may solve a problem without any code.
#36595
Posted: 04/29/2016 02:38:07
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Dmytro,
thank you for your quick response, I've installed version 14.0.290, but with the same result.
http://jpeg.cz/images/2016/04/29/6ApLK.jpg
(can't use IMG tag, picture is stretched)

Any recommendations?

Regards,
Jakub
#36600
Posted: 04/29/2016 04:51:02
by Dmytro Bogatskyy (EldoS Corp.)

Hi,

Quote

Any recommendations?

I have checked this and couldn't reproduce your issue.
Could you please answer the following questions:
What Delphi version are you using?
Did you create a signature using PDFBlackbox\Signer or SecurePDF sample? What "widget font and encoding" option did you choose?
What Adobe Reader version are you using?
#36609
Posted: 04/29/2016 07:40:04
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Hi Dmytro,

What Delphi version are you using?
Delphi 2009 Update4

Did you create a signature using PDFBlackbox\Signer or SecurePDF sample?
PDFBlackbox\Signer

What "widget font and encoding" option did you choose?
I've change a little bit logic of "If cbFont" conditions, so empty text in "widget font" ComboBox causes that the last "else" (line 46 below) is valid.

This is my code:

Code
if not Sig.Invisible then
        begin
// *************************************************************
          Sig.WidgetProps.BackgroundStyle := pbsNoBackground;
          Sig.WidgetProps.ShowTimestamp := false;
          Sig.WidgetProps.AutoPos := false;
          Sig.WidgetProps.AutoSize := false;
          Sig.WidgetProps.AutoText := false;
          Sig.WidgetProps.AutoFontSize := false;

          Sig.WidgetProps.Height := 100;
          Sig.WidgetProps.width := 200;

          Sig.WidgetProps.OffsetX := -9;
          Sig.WidgetProps.OffsetY := Document.PageInfos[0].Height - Sig.WidgetProps.Height + 37;

          sig.WidgetProps.Header := '';

          sig.WidgetProps.SignerInfo := 'ěščřžýáíéúů'+ #13#10+'ĚŠČŘŽÝÁÍÉÚŮ';

          sig.WidgetProps.AlgorithmInfo := '';
          //sig.WidgetProps.TimestampFontSize := 10;
          sig.WidgetProps.SignerCaption := '';
          sig.WidgetProps.AlgorithmCaption := '';
          sig.WidgetProps.SectionTextFontSize := 10;
          sig.WidgetProps.SectionTitleFontSize := 10;

// *************************************************************

          if (cbFont.Text = 'Free Serif, Unicode') then
          begin
            AddTrueTypeFont('FreeSerif', Sig.WidgetProps);
          end
          else
          //if (cbFont.Text = '') or (cbFont.Text = 'Helvetica') then IS CHANGED TO
          if (cbFont.Text = 'Helvetica') then
            // Helvetica font is default
          else if (cbFont.Text = 'Helvetica, Win-1252') then
          begin
            ....
          end
          else if (cbFont.Text = 'Helvetica, Auto Encoding') then
          begin
           ....
          end
          else
          begin // THIS IS VALID PART FOR EMPTY COMBOBOX.TEXT
            // Adding Type 1 font
           // Sig.WidgetProps.AutoAdjustEncoding := True;
            SimpleFont := TElPDFSimpleFont.Create;
            SimpleFont.BaseFont := 'Arial'; //cbFont.Text;
            Sig.WidgetProps.AddFont(SimpleFont);
          end;
        end;

It doesn't matter whether Sig.WidgetProps.AutoAdjustEncoding is true or false in my case.


What Adobe Reader version are you using?
Adobe Reader X

Regards,
Jakub
#36619
Posted: 05/03/2016 01:50:43
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Hi,
is there any progress? Could I do something to help you?
#36625
Posted: 05/03/2016 06:30:13
by Dmytro Bogatskyy (EldoS Corp.)

Hi,

Sorry, I have missed your answer.
Quote
I've change a little bit logic of "If cbFont" conditions, so empty text in "widget font" ComboBox causes that the last "else" (line 46 below) is valid.

I see, Arial font is not standard PDF font, so the component doesn't generate its metrics (character width automatically). You can try to handle TElPDFSignatureWidgetProps.OnLookupGlyphWidth event and set the character width for Arial font there.
PDF supports 14 standard fonts, they are as follows: Times-Roman, Helvetica, Courier, Symbol, Times-Bold, Helvetica-Bold, Courier-Bold, ZapfDingbats, Times-Italic, Helvetica-Oblique, Courier-Oblique, Times-BoldItalic, Helvetica-BoldOblique, Courier-BoldOblique.
Also, using not standard PDF fonts as Type1 font (TElPDFSimpleFont class) is not recommended, you should embed this font otherwise there is no guarantee that pdf reader will be able to show it.
By the way, did you try to use PDF standard fonts such as Helvetica?
#36641
Posted: 05/04/2016 11:59:09
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Hi Dmytro,
thank you for your response.

Did you try to use PDF standard fonts such as Helvetica?
Yes, I've tried all fonts from cbText combobox, only one shows Czech characters correctly: Free Serif Unicode.

try to handle TElPDFSignatureWidgetProps.OnLookupGlyphWidth event and set the character width for Arial font there.
Can't find out any info about OnLookupGlyphWidth in SecureBlackbox.chm file & forum, could you give me some clue please?

Embed Arial to PDF sounds more easier, I'm able to make arial.ufm (by ttf2ufm), but have no idea how to make files arial.w and arial.ctg. (similar to FreeSerif.ctg and FreeSerif.w). All three extensions are required inside of AddTrueTypeFont method.

Regards,
Jakub Fildan
#36645
Posted: 05/04/2016 14:34:46
by Dmytro Bogatskyy (EldoS Corp.)

Hi,

Quote

Yes, I've tried all fonts from cbText combobox, only one shows Czech characters correctly: Free Serif Unicode.

That's strange, I couldn't reproduce this issue.
Just in case, could you please check the value of SBUtils.SBB_VERSION_NUMBER variable, it should return your version '14.0.290.0'.
If the version is correct could please attach a sample pdf document. Please use Helpdesk ( https://www.eldos.com/helpdesk/ ) to post the documents to us privately.
Quote
Can't find out any info about OnLookupGlyphWidth in SecureBlackbox.chm file & forum, could you give me some clue please?

It defined as follows:
Code
  TSBPDFLookupGlyphWidthEvent = procedure(Sender: TObject; UCS : Integer; var Width : Integer) of object;

where UCS parameter is unicode character code and you should set Width parameter based on the UCS value.
Quote
Embed Arial to PDF sounds more easier, I'm able to make arial.ufm (by ttf2ufm), but have no idea how to make files arial.w and arial.ctg. (similar to FreeSerif.ctg and FreeSerif.w). All three extensions are required inside of AddTrueTypeFont method.

You don't need them, it is enough to generate *.ufm file only. AddTrueTypeFont() method requires only one of them.
#36646
Posted: 05/05/2016 02:30:54
by Jakub Fildan (Premium support level)
Joined: 04/07/2016
Posts: 16

Hi Dmytro,
I've misread that only ufm file is mandatory in AddTrueTypeFont, with embedded Arial everything works like a charm now!
http://jpeg.cz/images/2016/05/05/QqHWm.jpg

Thank you very much for your patience and advice!

Regards,
Jakub Fildan
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 4895 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!