#1 2012-10-18 12:35:44

BavDev
Member
Registered: 2012-10-18
Posts: 6

Rendering meta file does not work

Hello,
I have been trying (and erroring...) a while with the SynPDF and it looks if indeed the mostly proposed way of creating a meta file and then rendering it into PDF gives the best results.
However, I am experiencing several problems.

I have created the meta file using SetMapMode(MM_LoMetric) and writing directly to the Canvas. This is necessary since so I can use all my code written for the normal printer canvas.
I am rendering like this: PdfPrinter.Canvas.RenderMetaFile(MetaFile,1,0,0,false,99,99);

1. Rendering with wrong coordinates
The EMF file looks good but in the PDF output the lines are written from bottom up. I assume this has to do with the MM_LoMetric? When trying to write directly on VCLCanvas before, I read that there the coordinates do not follow the normal TCanvas standard. What do I have to set/initialize to get the right Y-axis direction?

2. Wrong place and scaling
The output is placed somewhere on the PDF page. It is out of the destination format A4. Actually I had increased the PDFPage.PageHeight until I could see the output. This is only for y-axis, X-positions are correct. Even if the lines are in the wrong order, then the last one (of a full page) should appear at the top of the page.
Obviously a scaling factor of 1 is wrong and gives too small output. But I tried something like DestinationWidth/SourceWidth, without success.
Any hints?

3. Resolution of the metafile
Using 96 DPI (Screen) looks perfect. But shouldn't a value of 300 (like printer canvas) also work? It does not, it gives me stange results. It looks like the scaling factors of a screen canvas are different to a printer canvas. Do I have any benefit at all when using a higher resolution for the meta canvas?

I can send you my EMF and PDF file by email if you need that.

Thanks in advance!

Offline

#2 2012-10-18 13:35:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Rendering meta file does not work

1. and 2. may need huge code refactoring to had such metrics, which are not handled yet by the conversion engine.

3. There is already something in the forum about this point.
AFAIR: change the dpi before adding a page.
See http://synopse.info/forum/viewtopic.php?id=313 and similar threads.

Offline

#3 2012-10-18 13:54:20

BavDev
Member
Registered: 2012-10-18
Posts: 6

Re: Rendering meta file does not work

ab wrote:

1. and 2. may need huge code refactoring to had such metrics, which are not handled yet by the conversion engine.

So you are saying: SynPDF cann not render meta files which had been created using MM_LoMetric? Please confirm explicitly.

ab wrote:

3. There is already something in the forum about this point.
AFAIR: change the dpi before adding a page.

I know that. This does not change the strange results. F.ex. horizontal scalings do not match the vertical scalings, only with 96dpi this is correct.

You did not answer my last question:
Do I have any benefit at all when using a higher resolution for the meta canvas?

Best regards

Offline

#4 2012-10-18 19:37:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Rendering meta file does not work

BavDev wrote:

So you are saying: SynPDF cann not render meta files which had been created using MM_LoMetric? Please confirm explicitly.

Yes, this was not tested, nor I think implemented yet.
Perhaps it is easy to add, but I do not have the time to do it now.

BavDev wrote:

Do I have any benefit at all when using a higher resolution for the meta canvas?

Only if it makes a difference for your TCanvas coordinates, which are integer.

Offline

#5 2012-10-19 15:58:35

BavDev
Member
Registered: 2012-10-18
Posts: 6

Re: Rendering meta file does not work

Just to inform you.
Finally I found by the right equivalent settings that there is no difference in output quality between drawing directly on the VCLCanvas and drawing on TMetaFileCanvas. So I have continued with using VCLCanvas. The wrong coordinates (because it is not MM-LoMetric capable) were not a big problem since I can translate the mm-coordinates to pixel once I found the right scaling factor.

Right now I have one issue remaining. Drawing text using ETO_Clipped does not work on the VCLCanvas. F.ex. I am writing
ExtTextOut(ADC, X, Y, ETO_Clipped, @ARect, PChar(AText), -1, nil);
This must clip the text at the right side if it does not fit into the ARect. But it does not with VCLCanvas. I need this urgently because in my reports the values must strictly follow the columns and they must not overwrite neighboured columns. Any idea? Is there any setting in TPdfDocumentGDI which enables this?

Thanks

Offline

#6 2012-10-19 16:34:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Rendering meta file does not work

Another user (Sinisa) is currently working on adding clipping to the engine, and also fixing some world-transform issues.

It will be published as soon as available.
Stay tuned!

Offline

#7 2012-10-19 18:32:37

BavDev
Member
Registered: 2012-10-18
Posts: 6

Re: Rendering meta file does not work

Perfect!
Hopefully within the next 3-4 weeks!

To summarize for all who read this and are still researching for a PDF lib:
I tested so many expensive libs and they all had too much overhead/functions which I don't need and which I don't want to pay for. With Synopse open source I had the source code and could learn its workings much quicker than without source of the trial versions.
And now one absolutely primary criterium. Synopse creates by far the smallest PDF file sizes of all what I had tested. F.ex. a normal report is 200KB while with others the same report gets up to 56MB!

Great work! Keep on working... :-)

Offline

#8 2012-10-24 21:36:44

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: Rendering meta file does not work

I have the same problems with Metafiles rendering.

Offline

Board footer

Powered by FluxBB