Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   QuickPDF (7.21) und Unicode (https://www.delphipraxis.net/157247-quickpdf-7-21-und-unicode.html)

hoika 5. Jan 2011 06:05

QuickPDF (7.21) und Unicode
 
Hallo #,

benutzt jemand QuickPDF und Unicode ?
Laut Hersteller soll man bei der Delphi-Version (dcu) Utf8Encode benutzen,
bei der Darstellung von Text auf dem Bildschirm kommt aber Müll raus.


Heiko

ULIK 5. Jan 2011 08:13

AW: QuickPDF (7.21) und Unicode
 
Servus,

mit welcher Delphi-Version arbeitest Du denn: 2009 oder höher oder noch einer nicht Unicode-Version. Poste doch mal einen Text, den Du ausgeben willst und ich bastel hier mal ein Testprogramm zusammen.

edit: hab's grad mal mit Delphi 2010 getestet: da kommt wirklich nur Müll raus. Aber was funktionierte war der Umweg über die FontSubsets:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  ansistrText: ansistring;
  ansistrText2: ansistring;
  lOldOrigin: integer;
  lPDF: TQuickPDF;
  strText: string;
  strText2: string;
begin
  strText := 'İnsan oğulları üzerine ecdadım Bumın';
  strText2 := 'ก ข ฃ ค ฅ ฆ ง จ ฉ ช ซ ฌ ญ ฎ ฏ ฐ ฑ ฒ ณ ด ต ถ ท ธ น';

  lPDF := TQuickPDF.Create;
  try
    lPDF.UnlockKey('...');
    lPDF.LoadFromFile('test_unicode.pdf');
    with lPDF do
      begin
        lOldOrigin := GetOrigin;
        SelectPage(1);

        AddStandardFont(8);

        SelectFont(8);
        SetOrigin(1);
        SetTextColor(1, 0, 0);
        SetTextSize(18);

        // Turkish
        AddSubsettedFont('TimesRoman', 13, strText);
        ansistrText := GetSubsetString(strText);
        DrawRotatedText(30,30,0, ansistrText);

        // Thai
        AddSubsettedFont('TimesRoman', 15, strText2);
        ansistrText2 := GetSubsetString(strText2);

        DrawRotatedText(30,200,0, ansistrText2);

        SetOrigin(lOldOrigin);

        lPDF.RenderPageToFile(150, 1, 1, 'testimg.jpg');

        SaveToFile('result.pdf');

      end;
  finally
    lPDF.Free;
  end;
end;
Grüße,
Uli


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:32 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz