You are not logged in.
Pages: 1
Thanks, Adminitrator Ab
Well how do you set the VCL resolution?
Could you make a small example? Is there a X and Y resolution for the VCL canvas?
Thanks@
Fritz
Hello all. I have been using synopse PDF with delphi very well for a while. I am having trouble understanding relative vs. absolute positioning.
I am drawing on the canvas assuming a printer has a resolution of 600 x 600 dpi, so if I draw a rectangle at 600,600 to 1200,1200, this should theoretically print a one inch square etc.
When I print the drawing, if I don't choose scale to fit page, the drawing is skewed, such that the width is about on half of the height of my rectangle! I need to assure that the output is absolute, because I'm printing on three hole paper, etc.
I did set the ScreenLogPixels to 600, although there seems to be a separate scale for x and y ... Any thoughts?
procedure HappyPrint;
QPDF: TPdfDocumentGDI;
QPage : TPdfPage;
begin
//prints directly to PDF.
try
try
if Self.gtPDFDocument1.IsLoaded then begin
Self.gtPDFDocument1.Reset;
Self.gtPDFDocument1.Filename:='';
end;
if (not (Self.gtPDFViewer1=nil)) then
Self.gtPDFViewer1.PDFDocument:=nil;
QPDF:=TPdfDocumentGDI.Create;
QPDF.EmbeddedTTF:=False;
QPDF.CompressionMethod:=cmNone;
QPDF.ScreenLogPixels:=GCPDFxResolution;
QPDF.NewDoc;
QPage:=QPDF.AddPage;
QPDF.VCLCanvas.MoveTo(600,600) etc...
This is confusing me
Please, could you be more specific? I don't want margins, and I don't see any reference to margins in VCLCanvas. i am desperate!
Fritz
Thank you Is there a simple way to eliminate margins and draw directly on the page? I Thought i was doing that, but the PDF printer seems to add margins to the page that I was not aware of...
Fritz
Could anyone help to explain margins in PDF? Are they appended to the print surface? If I am drawing on a VCLCanvas at 600, 600 with resolution of 600 dots per inch, does this include Margins?
Are the margins part of the document or a function of the Viewer?
Thanks
Fritz
Howdy
I think SynOpse PDF is fantastic!
Is there any guidelines to determining Font size when ScreenLogPixels changes?
for example, if font.Size is set to 12 at ScreenLogPixels = 120,
if ScreenLogPixels is set to say 600 or 1200
the size of the displayed font is Tiny!
I can obviously make the font bigger, but other than trial and error, how can one get the equivalent
font size that is ScreenLogPixels dependent?
Thanks!!!
Fritz
Actually this works perfectly!
var MyX, MyY: Integer;
MyXLoc: Integer;
MyString: String;
lPdf : TPdfDocumentGDI;
lPage : TPdfPage;
begin
lPdf := TPdfDocumentGDI.Create;
try
lPdf.ScreenLogPixels:=600;
lPage := lPDF.AddPage;
lPdf.VCLCanvas.Brush.Style:=bsClear;
MyY:=300;
for MyX := 1 to 40 do begin
MyXLoc:=MyX*120;
MyString:=IntToStr(MyX);
lPDF.VCLCanvas.TextOut(MyXLoc, MyY, Mystring);
lPDF.VCLCanvas.Font.Size:= lPDF.VCLCanvas.Font.Size+4;
lPDF.VCLCanvas.Rectangle(MyXLoc, MyY, MyXLoc+lPDF.VCLCanvas.TextWidth(MyString), MyY+lPDF.VCLCanvas.TextHeight(MyString));
end;
lPdf.SaveToFile('c:\Syntest.pdf');
finally
lPdf.Free;
end;
end;
Sorry, thanks for the suggestion but that did not help. Did you try running this program and see the results?
Thank you
Fritz
I will try that. Thanks.
Hello
I am trying to write and draw text on the VCLCanvas.
This is a simple test to draw text in a high resolution environment (600 dpi as a typical laser printer)
This should draw the text and a box around it.
The text and boxes don't seem to align, unless i am doing something wrong.
Any Ideas
var MyX, MyY: Integer;
MyXLoc: Integer;
MyString: String;
lPdf : TPdfDocumentGDI;
lPage : TPdfPage;
begin
lPdf := TPdfDocumentGDI.Create;
try
lPage := lPDF.AddPage;
lPdf.ScreenLogPixels:=600;
MyY:=300;
for MyX := 1 to 40 do begin
MyXLoc:=MyX*120;
MyString:=IntToStr(MyX);
lPDF.VCLCanvas.TextOut(MyX*50, MyY, Mystring);
lPDF.VCLCanvas.Font.Size:= lPDF.VCLCanvas.Font.Size+4;
lPDF.VCLCanvas.Rectangle(MyXLoc, MyY, MyXLoc+lPDF.VCLCanvas.TextWidth(MyString), MyY+lPDF.VCLCanvas.TextHeight(MyString));
end;
lPdf.SaveToFile('c:\Syntest.pdf');
finally
lPdf.Free;
end;
Thank you all
I hope to explain myself, but when I set the pen width to one pixel and draw on the VCLCanvas of a TPdfDocumentGDI, the line width comes out relatively thick, and I can't set the line width any smaller than 1 as Canvas.Pen.Width is an integer. Setting to zero doesn't help.
I need to draw a tiny width line on paper. Is there a way to achieve this with VCLCanvas? I know it can be done with PDF.Canvas, but I would have to change alot of code for compatibility
Thanks
FRITZ
I Made myself a tiny program if this helps anyone!
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, SynPDF;
type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
lPdf : TPdfDocumentGDI;
lPage : TPdfPage;
begin
lPdf := TPdfDocumentGDI.Create;
try
lPdf.Info.Author := 'Tester';
lPdf.Info.CreationDate := Now;
lPdf.Info.Creator := 'Tester';
lPdf.DefaultPaperSize := psA4;
lPage := lPDF.AddPage;
lPDF.VCLCanvas.Pen.Width:=1;
lPDF.VCLCanvas.MoveTo(100,100);
lPDF.VCLCanvas.LineTo(500, 500);
lPdf.VCLCanvas.TextOut( 300, 700, 'This is some text.');
lPDF.VCLCanvas.Pen.Width:=2;
lPDF.VCLCanvas.LineTo(900, 500);
lPdf.VCLCanvas.TextOut( 300, 700, 'This is some text.');
lPdf.SaveToFile('c:\Syntest.pdf');
finally
lPdf.Free;
end;
end;
Howdy
I would love to use the syn PDF units. I don't see a simple example of what to include in the uses units etc. to write a simple "hello world" program. Maybe I missed that. Is there a step by step? I downloaded the source code, created a new project, but must add units to the Unit1 of my project. Any suggestions? I know delphi well and am using version 2010, and possibly XE in the near future.
Thank you all in advance
Fritz
Pages: 1