#1 Re: PDF Engine » FastReport PDF export using SynPDF » 2013-04-11 14:37:30

This is a really useful piece of code, it is a pity there is no explanation of how to use it. This makes it very hard for someone like me to actually do anything with it, even though I have been programming with Delphi for 10 years. A simple sample program showing how to integrate it into a program using Fast Reports would be really useful, I see a few people have requested this as well as me smile.

So other people know what to do:

1. Copy the DFM code into Notepad and save-as frxSynPDFExport.dfm, copy the PAS code into Notepad and save-as frxSynPDFExport.pas.
2. Put these 2 files into a folder on your computer which is on your delphi project path, and add fxxSynPDFExport to the uses clause of your project.
3. In your project replace all references to "TfrxPDFExport" components with references to TfrxSynPDFExport. If you work with visual components you will have to delete these.

With my set up doing this worked, but resulted in PDF files in which all the fonts were scaled to 75% of usual size on the page, leaving a lot of empty space.
But the PDFs were about 30 times smaller than the original frxPRFExport!!! which is a huge improvement.

I added the line:

    fPdfDocument.ScreenLogPixels := 96; //Had to reset this to scale the PDF correctly

To this function:

function TfrxSynPDFExport.GetPdfDocument: TPdfDocumentGDI;
begin
  if not Assigned(fPdfDocument) then
  begin
    fPdfDocument := TPdfDocumentGDI.Create;
    fPdfDocument.Info.Creator := Application.Name;
    fPdfDocument.Info.Author := Application.Name;
    fPdfDocument.ScreenLogPixels := 96;//84;//112;//72; Had to reset this to scale the PDF correctly
  end;
  fPdfDocument.ForceNoBitmapReuse := True;
  result := fPdfDocument;
end;

to get it to scale correctly.

Hopefully Fast Report will incorporate Snyopse PDF into their next release and then this will not be necessary!

Board footer

Powered by FluxBB