You are not logged in.
Pages: 1
My configuration is Delphi 5, the WPControls, and the IP (Wol2Wol) controls.
I have a requirement to print RTF to a PDF file, and having sucessfully implemented the SynPDF Unit, was hoping to use PrintRichText unit for this purpose. However, having downloaded the files in this thread have found them to contain Tnt components and a Variants Unit that I do not have. Are these readily available anywhere?
Even if I download them, I am using WP components for letter writing. Would I be able to convert the PrintRichTextEdit Unit to use them? ie does PrintRichTextEdit use properties that are not part of the fundamental TRichEdit component?
Thanks in advance for any assistance,
Geoff
I had read thriough the second reference but not the first. I will try that tomorrow. THANKS
Geoff
I have actually tried both ways thus:
pdfDoc.VCLCanvas.font.size := 10;
since the VCL font Size property is in pnts. I've also tried
pdfDoc.VCLCanvas.font.size := round(10 * (pdfDoc.ScreenLogPixels / 72))
incase the there is an error and the size were loading in pixels. I've also tried assigning a standart TFont, but however I set the font size the responce to
chwidth := pdfDoc.VCLCanvas.textwidth('n'); //= 2.64e-308
is always the same. (Yesterday the value was 0.67, but having reloaded Delphi the result today is always 2.64e-308. and this applies for all letters and letter strings. eg 'n' 'm' 'nn' 'i' 'abcedfghijklmnopqrstuvwxyz')
Textwidth is also a property of pdfDoc, but trying to access this results in an AV though I can't see why. It should just return a value of 0. (ie the only line is Result := 0 ).
Textwidth() is used extensively in SynPDF (as might be expected) so I guess it works, thus my only conclusion is that I am not setting somthing up correctly.
Can anybody tell me what I am doing wrong, or give me another way of accessing the text width please.
Thanks in advance,
Geoff
I am confused, or doing somthing wrong, or not understanding somthing.
I use the following code in the start of my Printer program
pdfDoc := TPdfDocumentGDI.Create;
pdfDoc.Info.Author:='';
pdfDoc.Info.Creator:='';
pdfDoc.DefaultPaperSize:=psA4;
pdfDoc.CompressionMethod:=cmFlateDecode;
pdfDoc.ScreenLogPixels := 600; // I assume this is in pixels per inch
pdfPage := pdfDoc.AddPage;
pdfDoc.VCLCanvas.Pen.Width:=1;
pdfDoc.VCLCanvas.font.name := 'Arial';
pdfDoc.VCLCanvas.font.height := round(10 * (pdfDoc.ScreenLogPixels / 72)) ; //10pnt
chwidth := pdfDoc.VCLCanvas.textwidth('n'); //= 0.676 pixels
chheight := pdfDoc.VCLCanvas.textheight('n'); //= 1.27e-311 pixels
My printer program relies heavily on sizeing text for things like wordwrap, grid layout, page positioning. Can anybody tell me how I can obtain the true width of some text in pixels (or points or em's or anything!)
Thanks in advance
Geoff
OK, my main problem is not knowing where the documentation is. Could somebody give me a reference please. At the moment I am simply working by using examples given in this forum!
Thanks in advance
Geoff
Have been playing with
pdfDoc.Canvas.DrawXObject(0, 0 , 250 , 300, objectname);
which appears to place objects in the "natural" position rather than their standard Delphi/Windows position. That is the code above would place the bottom left of the object at the ** bottom ** left corner, rather than placing the top left of the object at the top left corner of the canvas as with other Delphi items including for example:
pdfDoc.VCLCanvas.TextOut( 0,0, 'The quick brown fox jumped over the lazey dog');
which places the top left of the text at the top left of the canvas.
In order to place the object at the top left corner use:
pdfDoc.Canvas.DrawXObject(0, pdfpage.PageHeight - Objectheight , 250 , 300, objectname);
Pages: 1