Printing to a color PDF file.

This forum is for eXpress++ general support.
Message
Author
Hawk521
Posts: 3
Joined: Tue Apr 19, 2016 2:00 pm

Printing to a color PDF file.

#1 Post by Hawk521 »

I need to be able to print to a PDF file incorporating color text to highlight certain information in the PDF output.

On a laser printer I do this by embedding PCL (printer control language) into the printed text output. Works great on color laser printers.

And I use the "Bullzip PDF Printer" driver to capture some of print jobs to a (black&white) PDF file. That works great also but lacks color.

Where I'm challenged is creating the colorized text into the PDF output. BullzipPDF Driver indicates it supports creation of a color PDF file. But I've yet to master the technique to print in color via Bullzip PDF driver.

I have hope that the DCPRINT functions (that support a variety of fonts) can incorporate the color printing that I need. Is this possible? Perhaps there is a library of "color fonts" that I could acquire to simplify this task? Surely this is something the more adventurous of you have already done.

Any help or thoughts would be appreciated.

-Hawk521

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Printing to a color PDF file.

#2 Post by rdonnay »

The DCPRINT system can handle any colors you want and they will output very nicely with the Bullzip printer driver.

I will put together a small sample program for you tomorrow afternoon. I am busy all morning.
The eXpress train is coming - and it has more cars.

Hawk521
Posts: 3
Joined: Tue Apr 19, 2016 2:00 pm

Re: Printing to a color PDF file.

#3 Post by Hawk521 »

I have something that is working. Not sure how it compares to the 'correct' way to do this... Here is a snippet of my code that works with Bullzip PDF creation as well as printing directly to a color printer:

// This line is where I was trying to set default font and background colors. This didn't work so I commented it out.
DCPRINT FONT '12.Arial' // COLOR GRA_CLR_RED, GRA_CLR_WHITE

// The rest of this code works pretty much as I need it to. Have yet to find anything that documents the usage though.
@ nRow, 22 DCPRINT SAY 'Production Approval Sample Request' COLOR GRA_CLR_WHITE, GRA_CLR_BLUE
nRow += 2.5

@ nRow, 5 DCPRINT SAY 'Customer' FONT '16.Arial.Bold' COLOR GRA_CLR_RED, GRA_CLR_WHITE
IF EMPTY(cCustName)
@ nRow, 15 DCPRINT SAY '_______________________'
ELSE
@ nRow, 17 DCPRINT SAY cCustName COLOR GRA_CLR_RED
ENDIF

@ nRow, 39 DCPRINT SAY 'CO#' COLOR GRA_CLR_GREEN
IF EMPTY(cCoNumber)
@ nRow, 41 DCPRINT SAY '_________________'
ELSE
@ nRow ,43 DCPRINT SAY cCoNumber COLOR GRA_CLR_GREEN, GRA_CLR_WHITE
ENDIF

@ nRow, 59 DCPRINT SAY 'PO# ' COLOR GRA_CLR_RED, GRA_CLR_YELLOW
IF EMPTY(cPoNumber)
@ nRow, 61 DCPRINT SAY '_________________'
ELSE
@ nRow ,63 DCPRINT SAY cPoNumber COLOR GRA_CLR_BLACK, GRA_CLR_YELLOW
ENDIF
nRow += 2.5

@ nRow, 5 DCPRINT SAY 'Style / Color' COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
IF EMPTY(cItem)
@ nRow, 18 DCPRINT SAY '_______________________'
ELSE
@ nRow, 20 DCPRINT SAY cItem COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
ENDIF

@ nRow, 45 DCPRINT SAY 'Piece Number' COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
IF EMPTY(cLotNO)
@ nRow, 58 DCPRINT SAY '______________________'
ELSE
@ nRow ,60 DCPRINT SAY cLotNo COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
ENDIF
nRow += 2.5

@ nRow, 45 DCPRINT SAY 'Ship Quantity' COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
IF nOrdQty = 0
@ nRow, 58 DCPRINT SAY '______________________'
ELSE
@ nRow, 60 DCPRINT SAY LTRIM(TRANSFORM( nOrdQty, '999,999.9 yards' )) COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE
ENDIF

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Printing to a color PDF file.

#4 Post by rdonnay »

You are the first person to suggest default colors. I'll see what I can do.

BTW - You can use Bullzip as your previewer.

Look at DC_PrintPreviewAcrobatOpt() and DCPRINT ON ... ACROBAT
The eXpress train is coming - and it has more cars.

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: Printing to a color PDF file.

#5 Post by sdenjupol148 »

DCPRINT does not currently offer a default color command such as DCPRINT COLOR although you may have inspired Roger to do something about that.
However, the next best thing is to use the ATTRIBUTE clause like this:

// declare the array
LOCAL aAttr := Array( GRA_AS_COUNT )

// set the foreground color
aAttr[GRA_AS_COLOR] := GRA_CLR_RED

// print the text
@ 30, 30 DCPRINT SAY "INTERNAL USE ONLY" ATTRIBUTE aAttr FONT '44.Stencil'

aAttr carries the foreground color GRA_CLR_RED.
I simply add ATTRIBUTE aAttr to every DCPRINT SAY ... command and the characters will come out in red


But now for the fun part.

The aAttr array contains many more elements one of them being angle.
So to create a watermark I would set the angle to something like
aAttr[GRA_AS_ANGLE] := {1,1}

Then change the color to a pale gray.
aAttr[GRA_AS_COLOR] := GRA_CLR_PALEGRAY

And then print the watermark itself using the ATTRIBUTE command
@ 30, 30 DCPRINT SAY "INTERNAL USE ONLY" ATTRIBUTE aAttr FONT '44.Stencil'

I can then print anything after, before or on top of that.

Check ATTRIBUTE in the under DCPRINT in the help file.

Bob

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Printing to a color PDF file.

#6 Post by rdonnay »

I forgot that the DCPRINT system already has a methodology for setting default colors:

Code: Select all

#INCLUDE "dcprint.CH"
#INCLUDE "GRA.CH"

FUNCTION Main()

DCPRINT ON ACROBAT 

DCPRINT ATTRIBUTE TEXT DC_Color2Attr(GRA_CLR_BLUE,GRA_CLR_PALEGRAY)

@ 10,10 DCPRINT SAY 'This should be blue on gray'

@ 12,10 DCPRINT SAY 'This should be red on yellow' COLOR GRA_CLR_RED, GRA_CLR_YELLOW

@ 14,10 DCPRINT SAy 'This should be blue on gray'

DCPRINT OFF

RETURN nil


PROC appsys ; RETuRN
The eXpress train is coming - and it has more cars.

Hawk521
Posts: 3
Joined: Tue Apr 19, 2016 2:00 pm

Re: Printing to a color PDF file.

#7 Post by Hawk521 »

Thanks for the help guys. I think I can get this project done with these tools. It's almost too easy! lol

Have a great week. I sure will! :) And my users will be delighted by the color PDF files - no longer requiring so many printed reports is a solid bonus for one and all.

With this color PDF option I can continue building on what amounts to an in-house document processing system.

-Hawk

PS - One of these days I'm going to uncork Alaska 2.0 and see how well it works. Is it compatible with the existing EXP19 library of tools? Does it require recompile of all the express++ dlls? If so it puts a damper on the roll-out options, as the runtime library becomes somewhat dependent on the version of the EXE file... Hmmmm... Too much to fret over for now.

User avatar
Auge_Ohr
Posts: 1409
Joined: Wed Feb 24, 2010 3:44 pm

Re: Printing to a color PDF file.

#8 Post by Auge_Ohr »

Hawk521 wrote:PS - One of these days I'm going to uncork Alaska 2.0 and see how well it works. Is it compatible with the existing EXP19 library of tools? Does it require recompile of all the express++ dlls?
same as you Source Code.
Roger have include v2.x BAT Files so it is no work
Hawk521 wrote:If so it puts a damper on the roll-out options, as the runtime library becomes somewhat dependent on the version of the EXE file... Hmmmm... Too much to fret over for now.
don't care about "Continues delivery" of XBase++ 2.0 ... same promises like every year ;)
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Printing to a color PDF file.

#9 Post by rdonnay »

One of these days I'm going to uncork Alaska 2.0 and see how well it works. Is it compatible with the existing EXP19 library of tools? Does it require recompile of all the express++ dlls? If so it puts a damper on the roll-out options, as the runtime library becomes somewhat dependent on the version of the EXE file... Hmmmm... Too much to fret over for now.
Don't fret.

eXpress++ supports both 1.9 and 2.0

It has binaries (dlls and exes) for both versions. Just set your path as described in readme.txt.

No recompile necessary.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1409
Joined: Wed Feb 24, 2010 3:44 pm

Re: Printing to a color PDF file.

#10 Post by Auge_Ohr »

rdonnay wrote:eXpress++ support both 1.9 and 2.0

It has binaries (dlls and exes) for both versions. Just set your path as described in readme.txt.

No recompile necessary.
i mean when Alaska release a new v2.x build ... at next Devcon ?
greetings by OHR
Jimmy

Post Reply