ReportPro3 PDF Export

This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
Post Reply
HeikoP
Posts: 48
Joined: Mon May 30, 2016 4:19 pm
Location: Germany

ReportPro3 PDF Export

Post by HeikoP »

Hello,

we found out, that exporting in a PDF creates a different size of the report compared to the result from an external PDF printer driver like Microsoft PDf or PDF24. It seems that the height is the same, but the width is a little smaller and the offset is moved to the left.

So if you would reprint the document from a saved pdf, it shows a different result than that what is printed directly to the printer. Does anonybody have similar problems or knows how to fix it?

TIA

Heiko
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

ReportPro3 PDF Export

Post by ic2 »

Hello Heiko,

I wondered if the PDF's from Microsoft PDF and PDF24 are exactly the same?

What I remember from earlier PDF "sessions" is that every PDF creator shows some differences, also in how it looks.

Dick
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ReportPro3 PDF Export

Post by robert »

Heiko,
RP3 uses WPDF for PDF output. This code was created by Filip Fransen.
The page size is passed as an integer.
I suspect the different page size is the result of incorrect rounding.
Maybe we need to change the resolution ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
HeikoP
Posts: 48
Joined: Mon May 30, 2016 4:19 pm
Location: Germany

ReportPro3 PDF Export

Post by HeikoP »

Hello Dick,

Microsoft PDF and PDF24 both looks good. There are no visible differences in the reports i have testet. Binary they are of course not the same.

Heiko
HeikoP
Posts: 48
Joined: Mon May 30, 2016 4:19 pm
Location: Germany

ReportPro3 PDF Export

Post by HeikoP »

Robert,

that could be.

If also found this line of code:
DEFINE WPPDF_NoOffsetEMF := 32 // Activates an experimental switch which can help to remove unwanted X a,d Y offsets
I will try this setting (as an integer 1) as an initialize. And report what happens.

Heiko
HeikoP
Posts: 48
Joined: Mon May 30, 2016 4:19 pm
Location: Germany

ReportPro3 PDF Export

Post by HeikoP »

Robert,

i changed a method and got almost same results in creating a pdf compared to pdf24, but the code is really weird again.

Here are my changes. I tested them with DIN A4 and DIN A5 and different margins.

Heiko



METHOD ExportMF( sPED AS RPPageExportData, hMetaFile AS PTR, nPageNo AS LONGINT ) AS LOGIC PASCAL CLASS rpExportPDF

LOCAL nWIDTH, nHEIGHT AS FLOAT
LOCAL nTop, nLeft, nBottom as FLOAT
local nDPIDivisor:=20 as float

SELF:nLastPageNo:=nPageNo

// Calculate page : TWIPS -> 72 dpi
nWIDTH := sPED.nPaperWidth / nDPIDivisor
nHEIGHT := sPED.nPaperLength / nDPIDivisor
nLeft := sPED.nLeftMargin / nDPIDivisor
nTop := sPED.nTopMargin / nDPIDivisor

* WPDF_StartPageEx( self:liPDF, Integer(nWIDTH), Integer(nHEIGHT), iif( sPED.lLandscape, 90, 0 ) )
* Changed to no Rotation, the PDF should not display rotated!
WPDF_StartPageEx( self:liPDF, Integer(nWIDTH), Integer(nHEIGHT), iif( sPED.lLandscape, 0, 0 ) )

* WPDF_DrawMetafile( self:liPDF, hMetaFile, Integer(nLEFT), Integer(nTOP), Integer(nWIDTH-nLEFT), Integer(nHEIGHT-nTOP) )
* I really wonder why this changes the PDF in almost the same layout compared to PDF24.
* Especially I can´t explain the 1.6 factor, but somehow this works.
* nLeft+(nLeft*0.083+8.2) is also really magic, but i transformed the offset to a linar equation, and it work too.
* maybe there are bugs in the pdf-Lib.

WPDF_DrawMetafile( self:liPDF,;
hMetaFile, ;
Integer(nLeft +((nLeft)*1.6)),;
Integer(nTop+48),;
Integer(nWIDTH-((nLeft+(nLeft*0.083+8.2))/1.6)),;
Integer(nHEIGHT-20);
)

WPDF_EndPage( SELF:liPDF )

RETURN TRUE
Post Reply