For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Plotting in 2d, the answer

Dmytro's picture

Printing from View2D is problematical.

First, there is an error in WNT_GraphicDevice.cxx. A line

if ( GetObject ( hBmp, sizeof ( BITMAP ), &bm )) {

should be at least like this

if ( GetObject ( hBmp, sizeof ( BITMAP ), &bm ) && bm.bmWidth>1 && bm.bmHeight>1) {

The second error is in WNT_DDriver.cxx. Lines

Standard_Boolean fSpoolRes1 = DoSpool ( fOrigSize, aPlotMode );
Standard_Boolean fSpoolRes2 = (aPlotMode == Aspect_PM_FILEONLY ?
Standard_True :
DoSpool ( fOrigSize, Aspect_PM_FILEONLY )
return (fSpoolRes1 & fSpoolRes2);

should be changed to

return DoSpool ( fOrigSize, aPlotMode );

Then printout is very simple:

Handle(WNT_DDriver) aPrintDriver = new WNT_DDriver("Lexmark Z25-Z35", "c:\\Occ", WNT_OT_PORTRAIT,1);

Note the path cannot contain an extension.

Executing WNT_DDriver::Spool() has some instability when printing to file. The matter is backslashes in OpenCascade paths are always converted to slashes /. The result is path for .prn - file always contain slashes instead of backslashes. Not all printer drivers can manage this. E.g. my "HP Color LaserJet PS" driver succeeded to form a *.prn file, and the "Lexmark Z25-Z35" failed. It seems one has to make the OSD_Path class to use backslashes instead of slashes.
Good Luck!

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.