You are not logged in.
Pages: 1
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
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
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
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
Pages: 1