Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Divide by 0 when sending report to PDF

Hi

Getting a divide by zero error when sending a report to PDF. The report is fine when run to the report builder viewer but when a print to a PDF file is attempted I get a divide by zero is the following place

ppPDFCanvas
procedure TppPDFCanvas.SelectWorldTransform(aScaleX, aScaley, aOrgX, aOrgY: Double);

if FTransformModified then
begin
SelectScaling((FInitialTransform.ScaleX / FModifiedTransform.ScaleX), (FInitialTransform.ScaleY / FModifiedTransform.ScaleY));
RestorePageHeight;
SavePageHeight(FInitialTransform.PageHeight);
SelectCoordintateSpace((FInitialTransform.OrgX - FModifiedTransform.OrgX), (FInitialTransform.OrgY - FModifiedTransform.OrgY), PageHeight);

//FPageHeightPos := FInitialTransform.PageHeightPos;
end;

The values I have are

FModifiedTransform.ScaleX = 0
FModifiedTransform.ScaleY = 0

The report output is a simple table (from word) with 14 columns and 3 rows (including header row). The distinguishing part of this table is that the headings are all vertical text. It all seems to work with a table and horizontal text.


Delphi RIO 10.3
RB 19.03

Regards
Andrew

Comments

  • Hi Andrew,

    If possible, please send a copy of the Metafile to us for testing. A divide-by-zero case should not ever happen when processing a WorldTransform operation but it appears there is a case where it does.

    Send the example image to support@digital-metaphors.com.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Email sent
  • Thanks for the example.

    Please note that this issue only arises when a rotated object is displayed using the TRichView plugin for ReportBuilder. TRichView uses a method to rotate the coordinate space of a Metafile that is not currently supported by the ReportBuilder PDF export. This is something that we will research and add for a future release.

    There is a patch available for RB 20.04 that resolves the "divide-by-0" error. Registered users of RB 20.04 with a current softwares subscription can email support@ to receive the patch.

    For now, the best way to work around the rotation limitation is to export this image as a bitmap using the TppImage.ExportMetafileAsBitmap property (or similar property for the TRichView control). Also be sure to set PDFSettings.ScaleImages to False to get the best quality image.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.