#1 Re: PDF Engine » Printing coordinates » 2011-12-31 16:46:57

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

#2 PDF Engine » Printing coordinates » 2011-12-30 20:54:03

photofritz
Replies: 2

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

#4 Re: PDF Engine » Help with Margins » 2011-05-25 20:56:22

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

#5 Re: PDF Engine » Help with Margins » 2011-05-25 19:23:50

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

#6 PDF Engine » Help with Margins » 2011-05-25 15:34:13

photofritz
Replies: 6

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

#7 PDF Engine » Font Size » 2011-05-03 17:52:24

photofritz
Replies: 1

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

#8 Re: PDF Engine » Am I missing something? » 2011-05-03 15:16:41

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;

#9 Re: PDF Engine » Am I missing something? » 2011-05-03 14:04:02

Sorry, thanks for the suggestion but that did not help. Did you try running this program and see the results?

Thank you
Fritz

#11 PDF Engine » Am I missing something? » 2011-05-03 12:16:29

photofritz
Replies: 4

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

#12 PDF Engine » Canvas pen width versus PDF pen width » 2011-04-17 20:19:23

photofritz
Replies: 5

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

#13 Re: PDF Engine » Newbie » 2011-04-17 20:16:37

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;

#14 PDF Engine » Newbie » 2011-04-16 21:20:23

photofritz
Replies: 3

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

Board footer

Powered by FluxBB