Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Which api for rendering, printing and pdf generation?

187 views
Skip to first unread message

Ole Nielsby

unread,
Mar 28, 2010, 10:13:40 PM3/28/10
to
GDI/GDI+ allow the same rendering code to be used for
screen display and printing, and, indirectly, for PDF generation
using special printer drivers such as CutePDF.

Can I switch to Direct2D/DirectWrite and still use the same
rendering code for screen rendering and printing, and will
I get sensible and reasonably compact PDF files when printing
through a PDF-producing pseudo printer driver?

For now, my understanding is, screen display is done by using
Direct2D/DirectWrite on top of DirectX whereas printing can
be accomplished by using the same Direct2D/DirectWrite calls
on top of a GDI/GDI+ printing context. But the DirectStuff api
docs don't mention printing, so I'm really just guessing.

The docs do mention the use of software renderers to render
things on a GDI bitmap - but it's not clear whether or how
this will work with a printing context.

I understand these new APIs were designed for accelerated
screen display, with printing being a lesser concern. But I'd
find them less attractive if I'd have to maintain old-style
GDI rendering code for printing, in parallel with the new-style
DirectStuff rendering code for screen display.

-----------------Why I want this-------------------

I once wrote a note typesetting system, using GDI for the
rendering. I still use it for vocal scores but I'm not happy
with the rendering code. The text placement (which is a
major pain with vocal scores) is resolution dependent and
not proper wysiwyg, so what looks fine on screen can be
a mess when printed because the slightly different spacing
makes words overlap or collide with musical symbols.

I might be able to improve on it by using GDI calls that
calculate the glyph placements in high-res before
rendering them in device res, but I'd prefer to use the
new apis - if and only if I can still produce PDFs using
the same rendering code I use for the screen.

(Actually, matters are a bit more complicated, involving
a homebrew programming language, a cross-platform
framework, a choral website, the bones of an 824 year
old queen, and other stuff not really suitable for this NG,
but the end point is: can DirectStuff rendering be captured
as PDF, by GDI roundtripping or some other means???)

---------------------------------------------------
Regards/Ole Nielsby
-my mail reply addres should have all d's replaced with l's-

Ole Nielsby

unread,
Mar 29, 2010, 1:58:46 PM3/29/10
to

Please ignore, the ID2D1DCRenderTarget object allows
me to use Direct2D drawing on a GDI printing context.

(I missed this because I used "printing" in all my searches.)

Namlooker

unread,
Jun 16, 2010, 8:31:51 AM6/16/10
to

Can someone please spread some light on this?

I'm having trouble drawing with Direct2D on a printer DC.

Drawing on screen works just fine. I can mix Direct2D and GDI on the same
HDC, but if the DC corresponds to a printer, the BindDC method of
ID2D1DCRenderTarget fails with E_INVALIDARG.

Does the ID2D1DCRenderTarget need to created in a different way for
printing, or what else could be wrong?

Thanks

0 new messages