How can I generate a .pdf file from a .prc database?

  1. FAQ
  2. »
  3. PDF and PRC Questions

Please use the following code fragment as a sample:

{
  // open .prc for read and write access
  OdStreamBufPtr pPrcStream = odrxSystemServices()->createFile("\\input.prc", Oda::kFileRead, Oda::kShareDenyNo, Oda::kOpenExisting);

  // load special module
  OdPrcToPdfModulePtr pModule = ::odrxDynamicLinker()->loadModule(OdPrcToPdfModuleName, false);

  // create new .pdf file
  OdStreamBufPtr pPdf = odrxSystemServices()->createFile("\\output.pdf", Oda::kFileWrite, Oda::kShareDenyNo, Oda::kCreateAlways);

  // insert .prc to .pdf with some default paper and 3D View parameters.
  OdResult res = pModule->prcToPdf(pPrcStream, pPdf);
  ODA_ASSERT(res == eOk);
}

You can use a more complicated version of the prcToPdf() method:

virtual OdResult prcToPdf(OdStreamBufPtr pPrcStream, OdStreamBufPtr pPdfStream, const OdGsPageParams &pdfParams, const OdGeMatrix3d &C2W, double CO, double OS);

For additional information about C2W, CO and OS parameters, please see the AdobeĀ® Portable Document Format specification.