You are not logged in.
Pages: 1
Hello Arnaud,
Your Pdf Engine is a great product.
I use it for more then last half year. At a very beginning I found problem with Courier New font (pdf from example below I send you to email mentioned during registration). Then I used Lucida Console instead, that works OK, but people don't like this font.
I always thaught new version of pdf engine corrects this, that never happend. Now I tried last one, 1.12 and it is the same.
My computer is W7 64 bit, Delphi XE.
I even tried D2007 and WXP 32 bit w.o. success.
Would you be so kind and try to look to this problem?
Thanks,
Pavel
procedure TForm1.btnViaCanvasClick(Sender: TObject);
var
i:Integer;
PdfDocumentGDI: TPdfDocumentGDI;
begin
PdfDocumentGDI:=TPdfDocumentGDI.Create;
with PdfDocumentGDI do
try
AddPage;
with VCLCanvas do
begin
for i := 0 to 9 do
begin
Font.Name := 'Courier New';//'Courier';
Font.Size := 12;
//Font.Style := [fsBold,fsItalic];
TextOut(20, 100 + i*40,'Příliš žluťoučký kůň');
//TextOut(20, 100 + i*40,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
TextOut(20, 100 + i*40+20,'ερτυθσδφγη йцукенгш asdffghj');
end;
for i := 0 to 9 do
begin
Font.Name := 'Lucida console';
Font.Size := 12;
//Font.Style := [fsBold,fsItalic];
TextOut(20, 600 + i*40,'Příliš žluťoučký kůň');
//TextOut(20, 100 + i*40,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
TextOut(20, 600 + i*40+20,'ερτυθσδφγη йцукенгш asdffghj');
end;
end;
SaveToFile('TestVcl.pdf');
finally
Free;
end;
end;
Offline
What is the exact problem?
Some missing Unicode characters in the resulting PDF?
Did you try with UseUniscribe := true; ?
As stated in the source code, we didn't implement FontFallBack yet...
That's perhaps the problem here.
But Uniscribe should solve most of the other issues. It even handled glyph shaping and such...
And don't forget to use the last available version of SynCommons+SynPDF from http://synopse.info/fossil
Offline
Arnaud,
I used version 1.12 from few days ago.
I tried UseUniScribe:=true, no success.
In SynPdf you write:
// must contain ALL glyphs necessary for the supplied unicode text - squares
// or blanks will be drawn for any missing glyph/character
My output (either run my example or look to my email with testvcl.pdf) has for writing in COURIER NEW no squares or blanks, it just has 'international' characters overwritten over previous character.
And this is for Czech, Greek and Cyrilic (others I don't know).
I tried also Arabic, and it gives above mentioned squares.
Pavel
Offline
There was no official 1.12 version released yet, as far as I remember (only BigTable).
I didn't receive any mail. Where did you post it, and when?
But I was able to reproduce the issue.
I'll find out what's wrong with this.
I guess its about the font metrics which is stored wrongly for fixed-width font, for unicode characters...
Offline
Arnaud,
please, look to my sample code below.
When writing to VclCanvas SEPARATE CHARACTERS (range 32-511), they appear normally.
When writing to VclCanvas the same characters as STRING, they are overwriting each other for codes above 255.
I think this is something between your code and Courier New font and doesn't has to do anything with FontFallBack.
Pavel
procedure TForm3.Button1Click(Sender: TObject);
var
i, j: Integer;
s: string;
ch: char;
PdfDocumentGDI: TPdfDocumentGDI;
begin
PdfDocumentGDI:=TPdfDocumentGDI.Create;
with PdfDocumentGDI do
try
AddPage;
//UseUniScribe := true; {gives error during savetofile}
with VCLCanvas do begin
Font.Name := 'Courier New';
Font.Size := 12;
for i := 0 to 15 do begin
s := '';
for j := 0 to 31 do
if i*32+j>=32 then begin
ch := chr(i*32+j);
s := s+ch;
TextOut(10+j*20, i*50, ch);
end;
TextOut(10, i*50+25, s);
end;
end;
SaveToFile('TestVcl.pdf');
finally
Free;
end;
end;
Offline
You wrote answer when I was writing my another comment.
Greetings to France.
Pavel
Offline
Thanks to your source code sample, I found out the issue.
It was indeed a wrong width char calculation for fixed-width fonts, only for Unicode characters.
It did have nothing to do with fontfallback.
It's now fixed in our Source code repository.
Thanks for your report and interest!
Hope we'll make this unit always better (I'm currently trying to make it PDF/A-1 compliant).
Offline
I download it from code repository, many thanks for your immediate action.
Just a small remark - you have DefaultPaperSize for PdfDocument. I need from time to time also different orientation, i.e. poLandscape and I add it to every new version. Wouldn't it be useful to have it there from you?
I know you tried not to be dependent on Printers unit.
procedure TPdfDocument.SetOrientation(const Value: TPrinterOrientation);
var tmp: integer;
begin
FOrientation := Value;
if Value=poPortrait then begin
if FDefaultPageWidth>FDefaultPageHeight then begin
tmp:=FDefaultPageWidth;
FDefaultPageWidth:=FDefaultPageHeight;
FDefaultPageHeight:=tmp;
end
end
else begin // landscape
if FDefaultPageHeight>FDefaultPageWidth then begin
tmp:=FDefaultPageWidth;
FDefaultPageWidth:=FDefaultPageHeight;
FDefaultPageHeight:=tmp;
end
end;
end;
Offline
Works great through TPdfDocumentGDI.VclCanvas.
There are some buts with TPdfDocument.Canvas that I post with example tomorrow, maybe they are not on your side.
SynPdf: missing SetPDFA1 declaration.
Offline
Works great through TPdfDocumentGDI.VclCanvas.
There are some buts with TPdfDocument.Canvas that I post with example tomorrow, maybe they are not on your side.
OK - waiting for your feedback.
SynPdf: missing SetPDFA1 declaration.
What does it mean?
Perhaps you don't have the correct files: you need to retrieve SynPDF and SynCommons units from the same version.
Offline
1. Look please possibly to printer Orientation
2. SetPDFA1 declaration: it's OK - my mistake
3. Try please following code (VclCanvas/Canvas).
Maybe it works correct, maybe there is some wrong conversion from Unicode, comments are in source.
It works the same way for fixed-width and proportional fonts.
procedure TForm3.Button2Click(Sender: TObject);
begin
with TPdfDocumentGDI.Create do
try
AddPage;
UseUniScribe := true;
with VCLCanvas do begin
Font.Name := 'Courier New';
Font.Size := 14;
Font.Style := [fsBold,fsItalic];
TextOut(100, 100,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
// all characters printed correctly
end;
SaveToFile('TestVcl.pdf');
finally
Free;
end;
with TPdfDocument.Create do
try
AddPage;
UseUniScribe := true;
Canvas.SetFont('Courier New',14,[fsItalic,fsBold]);
Canvas.TextOut(100, 700,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
// ? only characters that exists in range 0..255 prints OK,
// others with removed signs
SaveToFile('TestDirect.pdf');
finally
Free;
end;
end;
Offline
Just a small remark - you have DefaultPaperSize for PdfDocument. I need from time to time also different orientation, i.e. poLandscape and I add it to every new version. Wouldn't it be useful to have it there from you?
I've added this new property to TPdfDocument, to handle a default orientation, when a page is about to be added:
/// the default page orientation
// - a call to this property will swap default page width and height if the
// orientation is not correct
property DefaultPageLandscape: boolean read GetDefaultPageLandscape write SetDefaultPageLandscape;
And this one to TPdfPage, for changing the orientation of the current canvas page:
/// retrieve or set the paper orientation
property PageLandscape: Boolean read GetPageLandscape write SetPageLandscape;
Offline
3. Try please following code (VclCanvas/Canvas).
Check out the interfaces:
/// show some text at a specified page position
procedure TextOut(X, Y: Single; const Text: PDFString);
/// show some unicode text at a specified page position
procedure TextOutW(X, Y: Single; PW: PWideChar);
So.... TextOut doesn't handle unicode, but only PDFString, i.e. ansitext!!!
Try again with TextOutW.
It's one drawback of making an unit working from Delphi 6 up to XE.
If you use TPdfDocument directly, you MUST check carrefully for the string types...
PDFString is not a generic string, it's an Ansi string, as most PDF tags are not Unicode at all, but raw 8 bit win-ansi...
That's why using the VCLCanvas, or TGdiPages, make sense for the end-user.
Offline
TextOut/TextOutW: I had to look to interfaces, sorry to disturb you.
Thanks for landscape support.
If everybody (every company) would support it's product like you, life would be so much easier.
Many thanks,
Pavel
Offline
That's because there are users like you, which supply good problem description, and some source code to reproduce it easily.
It helped me a lot, having such precise steps for reproducing the issue.
And we are not a company... since I'm a lonesome programmer, and making no money with all the published components.
I made those units because none was existing as open source yet.
And since I like Delphi very much, working open source libraries will always help the community, and the language.
Even if I didn't have enough money to buy the latest Delphi compiler (to be fair, it was because the amount was not worth it IMHO)!!!
Offline
Arnaud,
I have to (positively) disagree with you.
It is not about users (like me), they have to anyway transfer their problems to their suppliers. When the problem is then understandable to supplier, then it starts to be interesting. And your reaction was - GRREEAATT.
Pavel
Offline
Pages: 1