Divide by 0 when sending report to PDF

General TRichView support forum. Please post your questions here
Post Reply
civica_andrew
Posts: 7
Joined: Thu Nov 26, 2020 10:11 am

Divide by 0 when sending report to PDF

Post by civica_andrew »

Hi

I have raised this issue with digital-metaphors and they asked me to raise it here as they require a metafile that is produced by the TRichView RTF control (we use the DB version). We use v18.0.1 of TRichView.

Is it possible for you to generate the metafile and send it to DM?

This is the rtf

{\rtf1\sstecf27000\ansi\deflang2057\ftnbj\uc1\deff0
{\fonttbl{\f0 \fswiss Arial;}{\f1 \fswiss \fcharset0 Arial;}{\f2 \fswiss \fcharset0 Calibri;}}
{\colortbl ;\red255\green255\blue255 ;\red0\green0\blue0 ;}
{\stylesheet{\f0\fs24 Normal;}{\cs1 Default Paragraph Font;}}

\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\headery720\footery720\nogrowautofit\deftab720\formshade\nofeaturethrottle1\useltbaln1\dntblnsbdb\fet4\aendnotes\aftnnrlc\pgbrdrhead\pgbrdrfoot
\sectd\pgwsxn12240\pghsxn15840\guttersxn0\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\headery720\footery720\sbkpage\pgncont\pgndec
\plain\plain\f0\fs24
\trowd\trgaph108\lastrow\trftsWidth1\trautofit1\trpaddl108\trpaddfl3\trpaddr108\trpaddfr3\trpaddt0\trpaddft3\trpaddb0\trpaddfb3\trleft-108\tblindtype3\tblind0\trrh1408\trkeep\trbrdrt\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrr\brdrs\brdrw10\ltrrow
\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clpadt108\clpadft3\clpadr108\clpadfr3\cellx2897
\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clpadt108\clpadft3\clpadr108\clpadfr3\cltxbtlr\cellx5902
\pard\intbl\ssparaaux0\s0\ltrpar\qc\widctlpar
\prauth1\prdate1200374285{\*\oldpprops\pard\ql}\plain\f2\fs22\lang2057\hich\f2\dbch\f2\loch\f2\fs22\ltrch
Horizontal\cell
\pard\intbl\ssparaaux0\s0\li113\ri113\ltrpar\qc\widctlpar\plain\f0\fs24\plain\f2\fs22\lang2057\hich\f2\dbch\f2\loch\f2\fs22\ltrch
Vertical\cell
\intbl\row
\pard\ssparaaux0\s0\ql\plain\f0\fs24\par
}

This is the original post I made on the DM support forum

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
Civica H&SC
civica_andrew
Posts: 7
Joined: Thu Nov 26, 2020 10:11 am

Re: Divide by 0 when sending report to PDF

Post by civica_andrew »

This is the link to the support request on Digital-Metaphors forum

http://www.digital-metaphors.com/forums ... pdf#latest
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Divide by 0 when sending report to PDF

Post by Sergey Tkachenko »

I tested with ReportBuilder 20.03. It does not generate errors on PDF export, but Adobe Acrobat Reader DC shows an error message when opening, and does not display the second column.
I'll send the metafile to DM.
civica_andrew
Posts: 7
Joined: Thu Nov 26, 2020 10:11 am

Re: Divide by 0 when sending report to PDF

Post by civica_andrew »

Thanks for that.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Divide by 0 when sending report to PDF

Post by Sergey Tkachenko »

Here is the reply

Thanks for the metafile. As I suspected, the rotation is handled via WorldTransform routine which is not currently supported by ReportBuilder. I have already added partial support for this feature in the next release but it does not appear to fully work for your example. I will research further however I’m unsure if it will be added in time because we are just about feature complete. (I will try)

For now, metafiles that use this type of rotation will need to be exported as bitmaps.
Also, Nico attached a patch that fixes the "division by zero" error in RB 20.04.
I can forward this file to you, but since you use 19.03, I may be useless.

Currently, ppRichView exports to PDF as bitmaps if the report's PDFSettings.MetafileToBitmapQuality = 1 (this is a public, not published property).
Post Reply