PDF Export

I am having trouble getting the PDF export button to work. I am running D10.1.2, FR 6.2.16. (Development PC is Windows 10.)

The components on the screen are:
-frxDBDataset that uses an TADOQuery dataset
-frxReport
-frxADOComponents that uses a TADOConnection DefaultDatabase
-frxPDFExport with ShowDialog set to True
-frxMailExport with ShowDialog and ShowExportDialog both set to true

I can see the PDF export button, but it does nothing when I click it. I tried running the program on both Windows 10 and Windows 7 and neither will export. If I try to export as email, that export window pops up OK.

(I have the same component setup on my Delphi 2009 PC running FastReports 5.6.7 and the PDF export works fine.) I don't think this is a FastReports version issue because is was running 5.6.7 on the Delphi 10.1.2 PC and it did not work. I think that either I am missing a setting somewhere or Delphi Berlin is the problem.

Thanks in advance for any insights.

Rick Stephens

Comments

  • PolomintPolomint Australia
    edited February 2019
    G'day Rick,

    This is a strange one. We have PDF Export in a number of Apps which over the years have been built with FR5.x - FR6.2.16 on RAD Studio / Delphi 10 (Seattle), 10.2.x (Tokyo) and now 10.3 (Rio) [we skipped Berlin]. Our major App has the frxPDFexport Component in a separate unit that contains all our "common code" for reporting, i.e. not in same unit as the frxReport Component(s). But we've also simpler examples with everything in the one unit. All work correctly.

    We've not seen anything like your case.

    Have you tried stripping your App down to bare bones?

    We built a Testbed a while back to look into PDF Security; it just has a simple Form, frxReport and frxPDFexport Components, and dummy report without data. It works as expected in 10.2 and 10.3 when I checked this morning.

  • I wrote a quick test project under Delphi 10.1.2 and it worked fine.

    I then took the exact same components and dropped them onto my large project and the PDF export button does not work. However, if I directly export a PDF using the statement:

    frxReport1.Export(frxPDFExport1);

    then that works fine. (I certainly have ShowDialog and ShowProgress set to TRUE for the frxPDFExport1 component.)

    I have no idea of what is keeping the PDF button from launching its dialog. I suppose that I can add a PDF button to my project and bypass the viewer's PDF button, but that defeats the purpose of the viewer's PDF button. (This is frustrating!)

    Rick
  • PolomintPolomint Australia
    edited February 2019
    I have no idea of what is keeping the PDF button from launching its dialog. (This is frustrating!)
    G'day Rick,

    Which "edition" of FRv6 do you have (i.e. do you have Source)?

    On this old machine I only have FRv5 source code, so this may not get us any further, but...

    The frxPreview(.pas) module's Init Method iterates the Filters the Programmer has added to the App (PDF, Mail etc.) and if it locates one of type TfrxPDFexport it records the object in the Preview Form's Field FPDFExport, and also makes the Button PdfB "visible".
        if TfrxCustomExportFilter(frxExportFilters[i].Filter).ClassName = 'TfrxPDFExport' then
        begin
          FPDFExport := TfrxCustomExportFilter(frxExportFilters[i].Filter);
          PdfB.Visible := pbExportQuick in Report.PreviewOptions.Buttons;
        end;
    

    All reasonable so far.

    The logic for the PdfB "Click" tests the Field FPDFExport to ensure it is Assigned, before doing exactly what you did in your experiment.
    procedure TfrxPreviewForm.PdfBClick(Sender: TObject);
    begin
      if Assigned(FPDFExport) then
        FPreview.Export(FPDFExport);
    end;
    

    So in my (limited) search tonight, there seems to be a possibility that FPDFExport is getting reset to Nil somehow. As far as I can tell, this only happens in the FormCreate Method.

    So much for science. Now for intuition and speculation...

    While looking at this stuff, I wondered (1) if you have more than one TfrxPDFexport Component dropped on your App's Forms; and (2) what would be the result of having more than one? Also, is it possible the Form (on which the TfrxPDFexport Component is dropped) is being Freed before the Preview is shown?

    If you have access to FRv6 Source, can we check that it does the same thing(s) as the old FR v5 code?

    Cheers, Paul
  • Hi Paul,

    I have the Standard FR6, so no source. Also, there is only one frxPDFExport component. (Good thought, though!)

    The PDF button shows up, but does nothing when clicked. As I stated before, if I write a stripped down program that just views, then it works. I took the exact same components and dropped them into my large program and it does not work.

    That tells me that I have something that is interfering with the PDF export from the viewer. If I bypass the viewer and just export to PDF, that works. So, I am giving the user a separate button for PDF exporting a report.

    I really appreciate the insights and assistance. At this time, I am giving up on this application's FR viewer being able to export PDF. (I'll tell the users that it is a new feature! Ha!)

    Cheers,

    Rick
  • Having some problem a year latter;D changing an old app.

    Check include/lib pathnames (if you have relative paths change to full), remove frxExport component, add again. It works to me!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.