Is wPDF thread safe ? I mean, can I create dynamically a TWPPDFPrinter, use it and then through it away in a background thread?
Do I have to set special compiler defines for that ?
cu Christian
Is wPDF thread safe ? I mean, can I create dynamically a TWPPDFPrinter, use it and then through it away in a background thread?
Do I have to set special compiler defines for that ?
cu Christian
When do you think, unicode support will be available in wPDF?
cu Christian
Using SetTextAlign doesn't give better results.
Can you give me an example on how to use the SetViewPortAPI? I use the following code arround your component:
const
INCHES_PER_MILLIMETER = 1 / 25.4;
PDF_RESOLUTION = 300; // Pixel per Inch
PDF_A4_PAGEHEIGHT = Round(297 * INCHES_PER_MILLIMETER * PDF_RESOLUTION); // Masse in Pixel
PDF_A4_PAGEWIDTH = Round(210 * INCHES_PER_MILLIMETER * PDF_RESOLUTION);
function TBSPdf.MMToPixel(AMillimeter: Double): Integer;
begin
Result := Round(AMillimeter * INCHES_PER_MILLIMETER * PDF_RESOLUTION);
end; // TBSPdf.MMToPixel
procedure TBSPdf.StartPage;
begin
EndPage;
FPDF.StartPage(PDF_A4_PAGEWIDTH, PDF_A4_PAGEHEIGHT, PDF_RESOLUTION, PDF_RESOLUTION, 0);
FPageIsOpen := True;
end; // TBSPdf.StartPage
procedure TBSPdf.MmTextOut(AMmX, AMmY: Double; const AText: String; AAlign: TAlignment);
var
alignMode : Cardinal;
oldAlign : Cardinal;
begin
if AText = '' then Exit;
alignMode := TA_TOP or TA_NOUPDATECP;
case AAlign of
taRightJustify:
alignMode := alignMode or TA_RIGHT;
taCenter:
alignMode := alignMode or TA_CENTER;
else
alignMode := alignMode or TA_LEFT;
end; // case
oldAlign := SetTextAlign(FPDF.Canvas.Handle, alignMode);
FPDF.Canvas.TextOut(MMToPixel(AMmX), MMToPixel(AMmY), AText);
SetTextAlign(FPDF.Canvas.Handle, oldAlign);
end; // TBSPdf.MmTextOut
Alles anzeigen
I have some troubles with text spacing.
By default, sometimes the spacing between words is way to big. Then I tried the mode wpExactTextPositioning, but now there are uncontrolled spaces in the words (see "Switzerland" in the example).
Finally I set the mode to wpDontAdjustTextSpacing and the text looks fine.
The problem I have now is, that with Pdf.Canvas.TextWidth I don't get correct results, so I cannot right align the text correctly (see example the columns with month/year).
My question is, how can I calculate the exact width of the text, so that right alignment works with mode wpDontAdjustTextSpacing too?
Examples are at:
http://www.splash-software.ch/host/TEST_Normal.pdf
http://www.splash-software.ch/host/TEST_ExactTextPos.pdf
http://www.splash-software.ch/host/TEST_Dont…TextSpacing.pdf
cu Christian
Hello,
I want to create a PDF, where I would like to use "Arial narrow" as font. Now it looks like, this is not available on all computers.
- What happens with the PDF, if someone doesn't have this font on his computer?
- Since I have this font, am I allowed to provide the TTF file on my website?
cu Christian