#1 2011-12-30 20:54:03

photofritz
Member
Registered: 2011-04-16
Posts: 14

Printing coordinates

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...

Offline

#2 2011-12-31 09:37:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Printing coordinates

The printing will depend on the resolution used by the VCLCanvas.

So you do not have a one pixel = one 1/600 dpi at drawing.

You'll have to use the VCL page size, then compute the ratio.

Offline

#3 2011-12-31 16:46:57

photofritz
Member
Registered: 2011-04-16
Posts: 14

Re: Printing coordinates

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

Offline

Board footer

Powered by FluxBB