#1 Re: PDF Engine » Canvas pen width versus PDF pen width » 2011-06-16 13:06:29

Just and update.  Using a width of 1 instead of 0 solved my problem.

#2 Re: PDF Engine » Canvas pen width versus PDF pen width » 2011-06-15 16:49:02

Did this solution work for you guys?

It didn't seem to for me.  I tried setting ScreenLogPixels to 960 as a test and the rectangle still came out as 2 pixels thick.  Setting ScreenLogPixels is working properly in terms of changing the resolution of the VCLCanvas, but does not seem to be changing the thickness of the lines as hoped.

Here is my rectangle draw code, FCanvas is set to the PDFDocumentGDI's VCLCanvas.  The value being passed in for aWeight is 0.  In the on-screen display of the canvas the lines are 1 pixel thick.

procedure drawbox(aWidth, aHeight: TInches; Color: TColor; PenStyle: TPenStyle; weight: integer);
var rect: TRect;
begin
    // set the pen for the boundary
    FCanvas.pen.Width := aWeight
    FCanvas.pen.style := aStyle;
    
    with FCanvas do begin
        rect.left := FPositionX;
        rect.Top := FPositionY;
        rect.Right := FPositionX + aWidth;
        rect.Bottom := rect.Top + aHeight + 1;

        brush.Style := bsClear;
        Rectangle( rect );
    end;
end;

#3 Re: PDF Engine » Font Capabilities » 2011-06-15 16:08:14

Sorry for the lacking initial post.  My code is a bit complicated and I didn't want to post all of it or unravel it.  Of course my issue was hiding in the convolutions.  It was some outdated code that was mucking things up with setting the font incorrectly.

Anyhow, I wanted to come back and provide a little example of how I am using the tool.  This is part of a larger system that draws text and images to a TCanvas in the standard ways.  SynPDF drops in very nicely, all I have to do is set up the VCLCanvas and set it as the one to be drawn on.  smile

procedure InitPDF;
begin
    FPDF := TPDFDocumentGDI.Create;
    FPDF.CompressionMethod  := cmNone;  //For debugging
    FPDF.ScreenLogPixels := 96;
    FPDF.DefaultPageWidth := (FNoticeDef.PageWidth * 72) div 1000;  //We are working in thousands of an inch
    FPDF.DefaultPageHeight := (FNoticeDef.PageHeight * 72) div 1000;
    FPDF.DefaultPageLandscape := sameText(FNoticeDef.orientation,'landscape');
    FPDF.AddPage;

    Canvas := FPDF.VCLCanvas;
    Canvas.Font.Name := 'Courier New';
    Canvas.Font.Size := 10;
end;

#4 PDF Engine » Font Capabilities » 2011-06-10 13:11:26

Safetydan
Replies: 2

Hello,

First of all thank you for creating and maintaining this tool, so far I have been very impressed with it!

In my perusal of the forums I have seen bits of information on the font capabilities of the PDF engine but nothing really specific so I was hoping to clear some things up.

I have not had much success with fonts using VCLCanvas like so:

PdfDoc.VCLCanvas.Font.Name := 'Wingdings';

Using the pdf canvas directly with SetFont works properly.

Am I doing something wrong?

Thanks

Board footer

Powered by FluxBB