Silverfrost Forums

Welcome to our forums

Print graphics %gr via printer driver to PDF file

2 May 2008 7:08 #3138

I try to print a graphics (%gr) via a printer driver (PDF XChange) into a PDF file. The printer driver is working well for all Windows programs on my desktop but not for my FTN95 program. The output is always a PDF in black & white format. In other words, the colored graphics has been converted to black & white.

I guess the open_printer@ function does the not wanted conversion because it displays a different printer selection panel than all other Windows programs. The default printer settings seem to be black & white.

Has anybody an idea about a workaround?

Thankx WoSl

3 May 2008 6:21 #3139

I do not know why you are getting monochrome but you should only get the old style printer dialog if you have called USE_OLD_PRINT_DIALOG@(1).

3 May 2008 3:49 #3140

Hi Paul!

The function USE_OLD_PRINT_DIALOG@(1) doesn't make it better, no change at all. In addition, I tested the output on my (black/white) HP laserprinter. The output color is monochrome instead of a gray shading. I couldn't test it on a color printer so far.

It seems to me that I've made a mistake but could get it now. I hope somebody has an idea. Therefore, here is a piece of code ... it generates images in different colors. The screen output looks fine, the printer output not:

WoSl

PS: Sorry for the lengthy code ...

      winapp
      program PDFPrint
      implicit none
      include <windows.ins>
      external DrawG,PrintG
      integer i
      integer ihnd_print,ihnd_grap,ictrl
      integer g_width,g_depth
      common /handle/ihnd_print,ihnd_grap,ictrl
      common /screen/g_width,g_depth
      data ihnd_print,ihnd_grap,ictrl /1,2,3/
      g_width=0.85*clearwin_info@ ('SCREEN_WIDTH')
      g_depth=0.85*clearwin_info@ ('SCREEN_DEPTH')
      i=winio@ ('%ww[no_border]%ca[PDFPrint]&')
      i=winio@ ('%mn[&Exit]&','EXIT')
      i=winio@ ('%mn[&Draw]&',DrawG)
      i=winio@ ('%mn[&Print]&',PrintG)
      i=winio@ ('%pv%`gr[box_selection,'//
     *                  'rgb_colours,full_mouse_input]&',
     *          g_width,g_depth, ihnd_grap)
      i=winio@ ('%lw',ictrl)
      end
      integer function DrawG ()
c  Call Back Function: Draw Graphics
      implicit none
      include <windows.ins>
      integer i
      integer ihnd_print,ihnd_grap,ictrl
      common /handle/ihnd_print,ihnd_grap,ictrl
      i=select_graphics_object@ (ihnd_grap)
      call draw ()
      DrawG=1
      return
      end
      integer function PrintG ()
c  Call Back Function: Print Graphics
      implicit none
      include <windows.ins>
      integer i
      integer ihnd_print,ihnd_grap,ictrl
      common /handle/ihnd_print,ihnd_grap,ictrl
cc    i=USE_OLD_PRINT_DIALOG@(1)
      i=open_printer@ (ihnd_print)
      if (i.gt.0)  then
         call draw()
         i=close_printer@ (0L)
      end if
      PrintG=1
      return
      end
      subroutine Draw ()
      implicit none
      include <windows.ins>
      integer ir,ig,ib,iy,i,ix
      integer g_width,g_depth
      common /screen/g_width,g_depth
c  Draw color images
      iy=10
      ix=50
      i=0
      do ir=5,255,50
      do ig=5,255,50
      do ib=5,255,50
      iy=iy+10
      i=i+1
      if (iy+10.gt.g_depth)  then
         iy=20
         ix=ix+50
      end if
      call draw_filled_rectangle@ (ix,iy,ix+50,iy+10,rgb@(ir,ig,ib))
      end do
      end do
      end do
c  draw gray scaled images
      iy=10
      ix=300
      i=0
      do ir=5,255,10
      iy=iy+10
      i=i+1
      if (iy+10.gt.g_depth)  then
         iy=20
         ix=ix+300
      end if
      call draw_filled_rectangle@ (ix,iy,ix+50,iy+10,rgb@(ir,ir,ir))
      end do
      return
      end
4 May 2008 1:31 #3145

Put this at the start of your program:

call SET_RGB_COLOURS_DEFAULT@( 1 )

Regards

Ian

4 May 2008 2:06 #3146

Thankx Ian!

Short reply and great answer. It works now!

😄

WoSl

Please login to reply.