Use DrawingPrintManager from C++

By Adam Nagy

Here is a sample code that is using the DrawingPrintManager object to print the active drawing document:

// Make sure a Drawing Document is active
static void PrintDrawing(CComPtr app)
{
  CComQIPtr mgr =  
    app->ActiveDocument->GetPrintManager();
 
  MessageBox(
    NULL, mgr->Printer, _T("Currently selected printer"), MB_OK);
 
  mgr->PutPrinter(_T("\\adsbeidc1\HP LaserJet 5000 Series PCL"));
  mgr->ColorMode = kPrintColorPalette;
  mgr->NumberOfCopies = 1;
  mgr->Orientation = kLandscapeOrientation;
  mgr->ScaleMode = kPrintBestFitScale;
  mgr->SetSheetRange(1, 1);
  mgr->PaperSize = kPaperSizeA4;
 
  MessageBox(
    NULL, mgr->Printer, _T("Newly selected printer"), MB_OK);
 
  if (FAILED(mgr->SubmitPrint()))
    MessageBox(
      NULL, _T("Error with SubmitPrint"), _T("Error"), MB_OK);
}

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading