#1 2014-10-29 22:05:02

Bronsi
Member
Registered: 2014-10-01
Posts: 2

Use SynPdf to set metafile canvas size

I thought I'd posted this before so apologies if I have but I couldn't find anything when I searched.

I've been changing some of my print routines to now use metafile canvases instead of drawing direct to printer canvases so I can show some of the output on screen in a basic print preview/onscreen report. If the user then elects to print I simply stretchdraw the metafile canvases to printer canvases.

Recently I've incorporated SynPdf so they now have a choice of printing or saving the output as PDFs. This is superb and does exactly what you'd expect and works brilliantly.

The one area I've always had a problem with has been slight differences in printer page sizes, even within the same brand. For example I've two type of HP printer in my office and there is always a slight difference in the position of the outputs. No matter how I try and take into account any un-printable areas on the page etc. its never quite the same from printer to printer.

So my question is this - can I use SynPdf to set up the pages, for example as a 300dpi A4 page, and then use that to set up my metafile canvas rather than using the printer's handle?
My thinking is that at least the "pages" would then be consistent in size as A4 PDFs. Whether or not I use them onscreen or on paper.

Can it be done this way round?

Offline

#2 2014-10-30 08:05:00

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

Re: Use SynPdf to set metafile canvas size

At PDF level, there is no DPI.
All coordinates are floating-points, with 72 DPI resolution.
So you virtually have an infinite resolution, only depending on the floating-point precision.

If you use a TMetaFileCanvas for drawing, there you have a resolution.
For vectorial drawing, most of the time it does not change anything.
Only for bitmap pictures, you may have to compute the resolution.

In fact, the rendering resolution would depend on two factors:
- The TMetaFileCanvas resolution;
- The size on which you draw the TMetaFile in the pdf.

So there is no way of setting up "a 300 DPI A4 page".
You need to create a canvas with A4 aspect ratio, then render it on the PDF. And it will have the "infinite" resolution of PDF.

Offline

#3 2014-10-30 09:52:48

Bronsi
Member
Registered: 2014-10-01
Posts: 2

Re: Use SynPdf to set metafile canvas size

OK, so I just need to set up my metafiles to 2481 X 3507 then really? Hmm, ok, that's my next task sorted.

Diolch.

Offline

#4 2014-10-30 10:42:46

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

Re: Use SynPdf to set metafile canvas size

Bronsi wrote:

OK, so I just need to set up my metafiles to 2481 X 3507 then really?

Yes - this is the point.

Offline

#5 2014-11-01 17:04:39

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

Re: Use SynPdf to set metafile canvas size

Be careful: Metafiles have a limitation of 96 dpi (the screen dpi) per default.

Last edited by RalfS (2014-11-01 17:11:21)

Offline

#6 2014-11-01 19:04:38

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

Re: Use SynPdf to set metafile canvas size

In synpdf there is no notion of DPI AFAIK.

Offline

Board footer

Powered by FluxBB