Home General

Google Maps Within Subreport Printing To PDF

We've recently upgraded to v19 and have begun to implement the new Google Maps Component.

We have a GMap component within a SubReport that prints for each stop on our manifest. Through RAP we configure the map to display a marker at the Stops address.

This works excellent when printing to Screen and Printer. Unfortunately it does not work when printing to PDF. Instead all of the maps take on the marker of the first Stop in the manifest.

Sample of our RAP code (we've tried this on Detail BeforePrint BeforeGenerate, and Map.OnPrint).

GMap1.Address := TRIM(PLLoadConfirmStops['Street']) + ', ' + TRIM(Variable2.Value); //Variable2 is a city/state/zip combo
GMapMarker1.Address := TRIM(PLLoadConfirmStops['Street']) + ', ' + TRIM(Variable2.Value);

Ideas?

Comments

  • Hi Dusten,

    The PDF device uses image optimization logic to reduce file size which is likely causing this issue since the maps are being changed on the fly. Try disabling the optimization by setting the PDFSettings.OptimizeImageExport property to False.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • That works! Thanks. Is there anyway to modify that setting via RAP?
  • Update on this, hoping for some solution as we have some reports (for most of our customers) which need PDF Optimization, and other reports (for a small subset of our customers) which could benefit from the Google Maps.

    I've tried creating a RAP Function that toggles the OptimizeImageExport. Something like this:

    { TmyTogglePDFOptimizeImageExport }

    procedure TmyTogglePDFOptimizeImageExport.ExecuteFunction(
    aParams: TraParamList);
    var
    lbToggle : Boolean;
    lReport : TppReport;
    begin
    inherited;
    GetParamValue(0, lReport);
    GetParamValue(1, lbToggle);

    lReport.PDFSettings.OptimizeImageExport := lbToggle;
    end;

    class function TmyTogglePDFOptimizeImageExport.GetSignature: String;
    begin
    result := 'procedure TogglePDFOptimizeImageExport(aReport : TppReport; aToggle : Boolean);';
    end;

    class function TmyTogglePDFOptimizeImageExport.HasParams: Boolean;
    begin
    Result := True;
    end;

    class function TmyTogglePDFOptimizeImageExport.IsFunction: Boolean;
    begin
    Result := False;
    end;

    We've tried implementing this on OnPrintDialogCreate, OnFileDeviceCreate, OnBeforePrint and others. And while the RAP function does fire and seems to set the property, it's still not behaving as we'd like.

    Is there anything you can think of that would allow us to do this at Runtime / via RAP?

    Thanks again
  • Hi Dusten,

    The events you are using may be firing too late to make changes to the Report.PDFSettings and still take effect. Try using an earlier event such as OnInitializeParameters and see if that helps.

    Otherwise, before the report prints, you can try setting the PDFSettings of the file device itself rather than the report.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • That's working (Using OnInitializeParameters).

    Thank you Nico.
Sign In or Register to comment.