#1 2012-12-27 07:32:15

Syn
Member
Registered: 2012-12-27
Posts: 3

First page broken

Hi There,

i hope somebody here can point me in the right direction. I am moving from Delphi 2006 to Delphi XE3. In Delphi 2006 we have the Quick Report licenced only for the fact that we can produce some metafiles that can be sent by email.
Now we are planning to move to Delphi XE3 and i have the task of researching if this can be done without the proprietary QuickReport. We decided to move towards something more standard like PDF. Sadly the customers don't accept something like PDFCreator or similar on their machines.

So i stumbled upon your SynopsePDF engine which i think would fit perfectly. I done a quick test implementation, but eighter is the engine broken or i do something terribly wrong. The first page only shows the headline, the other content is missing. The folloe up pages are fine.

Here is the implementation which i use, engine version is 1.18:

// Save report to file
//
procedure TfrmPmKbReportPreview.saveToFile(const fileName: string);
var
   i: integer;
   pdf: TPdfDocument;
   metaFile: TMetaFile;
begin
   // Create pdf document
   pdf := TPdfDocument.Create;
   // pdf.UseUniscribe := true;
   // pdf.UseOutlines := true;
   // pdf.UseFontFallBack := true;

   try
	// Add each page
	for i := 0 to myPreviewBox.PageCount-1 do
	begin
           // Get the metafile
           metaFile := myPreviewBox.Printer.Pages.Page[i].Metafile;

           // Define pages
           pdf.DefaultPageWidth := MulDiv(metaFile.Width,72,Pdf.ScreenLogPixels);
           pdf.DefaultPageHeight := MulDiv(metaFile.Height,72,Pdf.ScreenLogPixels);

           // Add page
           pdf.AddPage;

           // Draw the page content
           pdf.Canvas.RenderMetaFile(metaFile,1,0,0);

           // Save metafile for debug
           metaFile.SaveToFile('d:\Meta' + IntToStr(i) + '.meta');
	end;

	// Save pagelist
	pdf.SaveToFile(fileName);
    finally
      	// Free the pdf document
      	FreeAndNil(pdf);
    end;
end;

I have uploaded the files for further examination if you want to take a look. I would be very thankful if someone can help me to determine the error.

The ZIP contains:

PDFCreator.pdf - Report was printed and saved with PDFCreator
SynPDF.pdf - Report was saved by SynopsePDF (First page broken)
Meta0.meta and Meta1.meta - The meta files from which the pdfs where produced

The Meta files seem to be ok, but there is a problem with the first page when saved with
Delphi 2006 (XE3 not tested yet). Follow up pages are fine.

The download link is: http://www.file-upload.net/download-697 … t.zip.html

Many thanks

Syn

Last edited by Syn (2012-12-27 07:58:35)

Offline

#2 2013-01-14 09:12:32

Syn
Member
Registered: 2012-12-27
Posts: 3

Re: First page broken

Hi There,

has anybody an idea what i can try to make it work?

Regards

Syn

Offline

#3 2013-01-16 09:30:44

Syn
Member
Registered: 2012-12-27
Posts: 3

Re: First page broken

Yesterday i had quite a long debug session and tried something different. Sadly new problems arouse.

The problem with the empty page (which is not empty but the font is white/invisible) comes from font style fsUnderline. When the page is rendered without fsUnderline the page looks ok.

But i've encountered new problems, maybe someone wants to look at them:

Problem with Underline Explanation
----------------------------------

When the PDF is rendered from a metafile which has some underlined text the rest of the page seems to
have the wrong font color.

Case A)

The SynPDF_Without_Underline files have the Headline Text ("Auftragsliste mit Summen") rendered without fsUnderline and only bold (lbl.Font.Style := [fsBold];) font style.
This seems to work. The first page is rendered ok.


Case B)

The SynPDF_Wit_Underline files have the Headline Text ("Auftragsliste mit Summen") rendered with fsUnderline and bold + underlined (lbl.Font.Style := [fsBold, fsUnderline];) font style.
This causes the problem. The first page is rendered, after the underlined text ist rendered something seems to be wrong (Font Color?).

*********************************************

Problem with Cutted Text
------------------------

When the PDF is rendered from a metafile some of the text seems to be cutted at the last character.

See CuttedTextArial.jpg for the positions on page 2. I do not know why this happens, but there seems to be a problem
with the text width calculation.

The first used font is Arial (CuttedTextArial.jpg). I changed the font to Calibri (CuttedTextCalibri.jpg) and this is even worse.

*********************************************

Problem with Error Dialog
-------------------------

When the PDF is printed an error dialog is raised from the Adobe Reader. Also the same problem arises sometimes when the pdf file is
scrolled via mouse wheel to the end of the document. This happens occasionally. See ErrorDialog.jpg.

*********************************************

The download link is: http://www.file-upload.net/download-706 … s.rar.html
(In each folder there is a Problems.txt explaining the problem in detail with screenshots, metafiles and pdf)

Greetings

Syn

Last edited by Syn (2013-01-16 11:55:14)

Offline

Board footer

Powered by FluxBB