My c++ MFC MDI application displays engineering drawings in its views. What is a good way to dump a CView derived object into a PDF file? What libraries could you suggest (not nesesery free)? I've looked into a few libraries like Cairo and libHaru. It is possible to draw all the graphic components but I was thinking that the CView has allready all the drawingins done. Can it be dumped into a PDF through a PS or something like it? Thanks
If you download CutePDF you can print directly to a PDF. Its just like normal printer based printing. I'm pretty sure if you get acrobat pro from adobe you can do the same thing.
Edit:
Using a device context you can do all your drawing in a way that "could" be used by a driver to store vector graphics.
If you handle the WM_PRINT command (ON_MESSAGE in your message map) then you are supplied an HDC. You can retrieve an MFC style CDC from the HDC by doing the following:
CDC* pDC = CDC::FromHandle( hDC );
Now you can issue standard DC drawing commands to the printer as follows:
int width = pDC->GetDeviceCaps( HORZRES );
int height = pDC->GetDeviceCaps( VERTRES );
pDC->MoveTo( 0, 0 );
pDC->LineTo( width, height );
This will draw a from the top left corner to the bottom right corner. If you scale all your vector graphics accordingly they will, hopefully (I'm, unfortunately, not sure of this, though), appear on the PDF as vector commands rather than raster commands.