Print Page | Close Window

Filling form fields with greek letters

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=2207
Printed Date: 03 May 24 at 3:59PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Filling form fields with greek letters
Posted By: LQ
Subject: Filling form fields with greek letters
Date Posted: 02 Apr 12 at 10:39AM
Hi, I'm evaluating your Library and it looks great,

I'm trying to fill a ready made pdf Form from a database and save the form to pdf for each record.
It works fine but not for the Greek text , if the field value is mixed English and Greek only the English text appears!
If I open the pdf form in adobe reader I can write Greek text in the fields!
what I'm doing is:

QP.LoadFromFile(pdfFormFile);
QP.SetFormFieldValueByTitle(sField,sVal);

after I finish filling up all the fields:
for fIDX:=Qp.FormFieldCount-1 downto 0 do  QP.FlattenFormField(fIDX);

QP.SaveToFile(NewPDFName);

Any idea?
I tried Delphi 6 on Win XP and also Delphi XE on Win 7, same results.

Thanks




Replies:
Posted By: AndrewC
Date Posted: 04 Apr 12 at 4:08AM
Here is some code that words generates Greek text in a formfield.

The trick is you need to use  QP.AddFormFont(fid); to add the font to the formfield as formfields need their own fonts for some reason.

            QP.SetOrigin(1);

            string text = "ABCDEF ΕΚΑΤΟΝ ΟΓΔΟΝΤΑ ΕΠΤΑ ΕΥΡΩ και ΕΞΗΝΤΑ ΛΕΠΤΑ";

            int fid = QP.AddTrueTypeSubsettedFont("Arial", text, 0);
            //int fid = QP.AddSubsettedFont("Verdana" ,12, text);
            int ffid = QP.AddFormFont(fid);

            int id = QP.NewFormField("FirstName", 1);
            QP.SetFormFieldBounds(id, 10, 20, 300, 20);
            QP.SetFormFieldHighlightMode(id, 2);
            QP.SetFormFieldFont(id, ffid);
            QP.SetFormFieldValue(id, text);
            QP.SetFormFieldDefaultValue(id, text);

            QP.SetNeedAppearances(0);
            QP.UpdateAppearanceStream(id);

            QP.SaveToFile("out.pdf");
            Process.Start(@"out.pdf");



Posted By: LQ
Date Posted: 04 Apr 12 at 10:43AM
Thanks Andrew,
what is this Text string, and how to get it for a different language?


Posted By: AndrewC
Date Posted: 04 Apr 12 at 11:18AM
That is Greek test but this Forum changes the text to some other encoding.  It was perfect Greek when I posted it.

Andrewn


Posted By: Renaud
Date Posted: 28 Apr 20 at 11:41AM
Hello, 

did any one tried that successfully using ActiveX from php ?
(DebenuPDFLibrary64AX1613)

I copied the code from Andrew ( thank you Andrew) 

but I still have bad result for non Latin Char.

see result and code below.

ABCDEF ΕΚΑΤΟΝ ΟΓΔΟΝΤΑ ΕΠΤΑ ΕΥΡΩ και ΕΞΗÎ

    $qp->SetOrigin(1);
    //$text = "ёяшертыуиопющэъасдфгчйкльжзхцвбнм";
    $text = "ABCDEF ΕΚΑΤΟΝ ΟΓΔΟΝΤΑ ΕΠΤΑ ΕΥΡΩ και ΕΞΗΝΤΑ ΛΕΠΤΑ";
    $fid = $qp->AddTrueTypeSubsettedFont("Arial"$text2);
    $ffid = $qp->AddFormFont($fid);

    $id = $qp->NewFormField("FirstName"1);
    $qp->SetFormFieldBounds($id102030020);
        
    $qp->SetFormFieldFont($id$ffid);
    $qp->SetFormFieldValue($id$text);
    //$qp->SetFormFieldDefaultValue($id, $text);
    $qp->SetNeedAppearances(0);
    $qp->UpdateAppearanceStream($id);
    $qp->SaveToFile("out.pdf");


Posted By: Renaud
Date Posted: 02 Jul 20 at 6:40AM
Hello, 

Thanks to Kevin from support issue is solved.
here is support answer :

it is not Quick PDF Library but rather PHP that is the issue.

change from this:
$qp = new COM('DebenuPDFLibrary64AX1613.PDFLibrary');

to this:
$qp = new COM('DebenuPDFLibrary64AX1613.PDFLibrary', NULL, 65001);

Now the interface between PHP and ActiveX will be Unicode enabled, and everything works as expected.

and to embed a little char as required i use AddTrueTypeSubsettedFont  option 4

$latin_letters = 'A';
$fid = $qp->AddTrueTypeSubsettedFont("Arial Unicode MS", $latin_letters , 4);
$qp->SelectFont($fid);
$ffid = $qp->AddFormFont($fid);

so when I do that : 

$textRussian = "Нет никого, кто любил бы боль саму по себе,";
$qp->SetFormFieldValue($id, $textRussian );


the sub set is automatically updated with only required char.







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