Page 1 of 1

Can't Find Declaration for TTeePDFPage

Posted: Wed May 20, 2015 1:02 am
by 16469462
I have just upgraded to C++ XE8 and have updated the Steema packages. My application uses the information in a TTeePDFPage class object to form PDF output. When I compile the application, it does not find the class declaration. I have scanned through the installed files and cannot find any reference to the class.

I looked at your latest reference document (that was downloaded along with the install), and it shows that the TTeePDFPage is part of the TeePDFCanvas unit.

Could you please let me know what I am doing wrong?

Thanks

Re: Can't Find Declaration for TTeePDFPage

Posted: Wed May 20, 2015 10:04 am
by yeray
Hello,

I'm afraid this unit suffered lots of changes, to support stand-alone PDF Canvas, better speed with images, etc, etc.
The TTeePDFPage doesn't exist any more. Try using TPDFDocument instead.

Re: Can't Find Declaration for TTeePDFPage

Posted: Wed May 20, 2015 8:32 pm
by 16469462
Thanks for the information. I can really appreciate that things like this have to change.

I do have a request. Is there any documentation, examples, or anything available regarding the use of TPDFDocument? This class is not included in the latest reference material and I would like to know how it is used. Once I have this information, I think I can make the adjustments that I need.

Thanks for any help you might provide.

Re: Can't Find Declaration for TTeePDFPage

Posted: Fri May 22, 2015 11:39 am
by yeray
Hello,

Here it is a simple test example showing how to create a multi-page pdf document and how to add charts, images or how to use custom drawing function in each page:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
const PDF='C:\tmp\test.pdf';

var c : TPDFCanvas;
    b : TBitmap;
begin
  c:=TPDFCanvas.Create;
  try
    c.Document.Orientation:=poLandscape;

    c.StretchDraw(Rect(50,150,400,400),Image1.Picture.Graphic); // png
    c.Draw(450,150,Image2.Picture.Graphic);  // png

    c.TextOut(50,50,'Hello');

    c.Font.Size:=24;
    c.TextOut(250,50,'World !');

    TPDFExportFormat.Draw(c,Chart1,Rect(0,80,500,300));

    b:=Chart1.TeeCreateBitmap;
    try
      c.Draw(350,650,b);
    finally
      b.Free;
    end;

    c.Brush.Style:=bsSolid;
    c.Brush.Color:=clLime;
    c.Pen.Style:=psSolid;
    c.Pen.Color:=clBlue;
    c.Pen.Width:=1;

    c.Gradient.Visible:=True;
//    c.Gradient.StartColor:=$8000FF00; // Alpha /CA Constant Opacity
    c.Ellipse(420,10,520,110);
    c.Gradient.Visible:=False;

    c.Pen.Style:=psDot;
    c.Rectangle(550,10,650,110);

    c.Brush.Style:=bsClear;
    c.Pen.Style:=psDash;
    c.Pen.Width:=3;
    c.TriangleWithZ(Point(660,110),Point(700,10),Point(740,110),0);

    c.NewPage;

    TPDFExportFormat.Draw(c,Chart1,Rect(0,80,500,300));

    c.NewPage;

    Chart1[0].FillSampleValues;
    TPDFExportFormat.Draw(c,Chart1,Rect(0,80,500,300));

    c.SaveToFile(PDF);
  finally
    c.Free;
  end;

  TeeGotoURL(0,PDF);
end;

Re: Can't Find Declaration for TTeePDFPage

Posted: Mon May 25, 2015 11:30 pm
by 16469462
The example was really helpful, thanks.

One more question. If I have an existing and already formatted TChart, how do I get it go to PDF? For example, I am displaying the chart to the user and he selects an option (which I give him) to export it to PDF, how can I control the output using TPDFExportFormat, TPDFCanvas, or some other class? In other words, how do I convert an existing chart to PDF?

Thanks for any help you can give.

Re: Can't Find Declaration for TTeePDFPage

Posted: Tue May 26, 2015 12:01 am
by 16469462
Figured it out. Just need to get it formatted correctly as it is on the screen.