Page 1 of 1

Once again about metafile

PostPosted: September 13th, 2012, 10:41 am
by seekbirdy
Ok, it's me again, and I still experiencing the problems with metafiles print.

At the beginning, I've got the problem with overlapping characters, as described here.
Btw, as I can see, I used TrueType/OpenType fonts - Times New Roman and Arial. I workarounded this problem as you suggested, by setting DirectPrint to True and rerendering the preview.

But after this I got another problem, which I mentioned here - I can see the pictures from metafiles in preview on the screen (which are placed to preview with PaintGraphicEx), but when I print them to the paper, I can't see these metafiles' content (other text placed by PaintRichText is printed).

So, what I have to do to have both non-overlapping chars and metafiles printed on the paper?

Thanks in advance,
Ilya.

Re: Once again about metafile

PostPosted: September 13th, 2012, 6:01 pm
by Kambiz
As far as I remember, this problem occurs with out dated printer drivers. Updating the driver may fix the problem.

Re: Once again about metafile

PostPosted: September 14th, 2012, 6:46 am
by seekbirdy
Do you mean the problem with metafiles or with TrueType-fonts overlapping?
Now I have all is OK (when use DirectPrint, and without it too) with printing on my computer, but no graphics on another one, so your assumption about driver problem gets confirmation.
But on the other hand, actually in both cases I print on one printer in network, so drivers are most likely identical.

Another clue: when I preview the document on "problematic" PC, I see overlapping characters, and then no graphics on the paper (but with no overlap due to DirectPrint, I guess), and all is ok with both preview and the printed paper on my PC.

So, what is the reason of that: the previews of the identical documents are different between two different PCs? Is any DLL like RichEd involved and they have different versions?

Thanks,
Ilya.

Re: Once again about metafile

PostPosted: September 15th, 2012, 3:37 pm
by Kambiz
If there is only one printer and it works on one machine but not the other, definitely the printer driver of that faulty machine is out dated.

Re: Once again about metafile

PostPosted: September 21st, 2012, 8:50 am
by seekbirdy
Hmmm... But then why all is working when I roll back the version of TPrintPreview to 5.13?
I can't understand what's happening...

Maybe you give me an advice about my scenario.
In details: first, I used v. 5.13 and all was ok with metafiles printing, but in some cases I got overlapping chars.
Then, I set DirectPrint to True and get my pictures badly scaled.
To overcome this problems, I upgraded to v. 5.60 and then to 5.80, and overlapped chars problem disappeared, but I can't see metafiles in some cases (but all is ok on the preview).

So, as you can see, in all the cases I get the problems with printing, and I've tried this on several printers and many computers.
And, I would prefer to keep the initial state of the software - use v. 5.13, seems like it's the most stable (for me) - at least my graphics are printed and they are scaled right and printed document is identical with its Preview.

But is any another way to overcome overlapping chars except DirectPrint? :) And what does it mean that the Preview shows the picture different that I see on the paper?
Sorry for so many (dumb?) questions, but I'm really stuck with this stuff and I'm frustrating to make it work properly.

Thanks in advance,
Ilya.

Re: Once again about metafile

PostPosted: September 21st, 2012, 11:04 am
by Kambiz
It would be nice if you please send me a sample code, so that I can run it on my computer and print a sample page.

Re: Once again about metafile

PostPosted: September 24th, 2012, 8:15 am
by seekbirdy
Ok, here is a sample project in the attachment (along with TPrintPreview 5.13 sources).

On some PCs/printers I get overlapped chars.
And another issue - when I re-generate preview, chart is re-scaled, so when I use DirectPrint=True I get a big chart which doesn't fit into the sheet. It's because ClientToPaper return some weird (big) values on the second generation of preview. Why is it so?

Thank you very much!
Ilya.

Re: Once again about metafile

PostPosted: November 4th, 2012, 5:07 pm
by Kambiz
I've realized that the problem is a GDI+ issue. This happens when the target device has a higher resolution than screen.
On the computer that your code works, probably GDI+ library is not in the search path and the component uses GDI to draw the metafile.
I'm trying to find a workaround for it.

By the way, you should use ScreenToPreview instead of ClientToPaper. The first function converts pixels in screen resolutions to preview units but the second one maps a point on the screen to paper coordinates.