forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Print graphics %gr via printer driver to PDF file

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wosl



Joined: 31 Jan 2008
Posts: 30

PostPosted: Fri May 02, 2008 8:08 pm    Post subject: Print graphics %gr via printer driver to PDF file Reply with quote

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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat May 03, 2008 7:21 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message AIM Address
wosl



Joined: 31 Jan 2008
Posts: 30

PostPosted: Sat May 03, 2008 4:49 pm    Post subject: Reply with quote

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 ...

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
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sun May 04, 2008 2:31 pm    Post subject: Reply with quote

Put this at the start of your program:

Code:

call SET_RGB_COLOURS_DEFAULT@( 1 )


Regards

Ian
Back to top
View user's profile Send private message Send e-mail
wosl



Joined: 31 Jan 2008
Posts: 30

PostPosted: Sun May 04, 2008 3:06 pm    Post subject: Reply with quote

Thankx Ian!

Short reply and great answer. It works now!

Very Happy

WoSl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group