Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - SetTextColor doesn't always work
  FAQ FAQ  Forum Search   Register Register  Login Login

SetTextColor doesn't always work

 Post Reply Post Reply
Author
Message
ChuckS View Drop Down
Beginner
Beginner


Joined: 10 Feb 14
Location: Illinois
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote ChuckS Quote  Post ReplyReply Direct Link To This Post Topic: SetTextColor doesn't always work
    Posted: 10 Feb 14 at 3:57PM
I'm very confused about the SetTextColor function:  it indicates that it takes RGB values as parameters:  to me, that indicates a standard RGB palette, but it doesn't seem to work that way.  These two lines BOTH produce a plain blue text color:


PDF.SetTextColor 0, 0, 255   ' This comes out blue, as expected...

and

PDF.SetTextColor 0, 0, 1   '  This also comes out blue, and it shouldn't be:  (0, 0, 1) is basically a black.

So how can I use this method to do something other than pure Red, Blue and Green, and the colors that can be gotten by a full mix of any two of those?  For example, this *should* print out text in pink, but it appears invisible (or white on white) on my PDF:

    PDF.SetTextColor 208, 32, 144
    PDF.DrawText 50, 110, "PINK colored text, doesn't show but can be copied"/

Here's a complete sample that spits out text in R, then G, then B, then tries pink:

' ************** Begin sample VB6 code
    Dim PDF As DebenuPDFLibraryAX1012.PDFLibrary
    lblPink.ForeColor = RGB(208, 32, 144)  ' This shows as pink, the same color the PDF won't show.
    ' Create new PDF and show; Red, Green and Blue text all print:  most other colors seem not to...
    Set PDF = New DebenuPDFLibraryAX1012.PDFLibrary
    PDF.NewDocument
    PDF.SetOrigin 1
    PDF.SetTextColor 255, 0, 0
    PDF.DrawText 50, 50, "RED colored text"
    PDF.SetTextColor 0, 255, 0
    PDF.DrawText 50, 70, "GREEN colored text"
    PDF.SetTextColor 0, 0, 255
    PDF.DrawText 50, 90, "BLUE colored text"
    ' This next text will not be visibile in the PDF, but can be selected, then copied and pasted elsewhere.
    PDF.SetTextColor Pink(0), Pink(1), Pink(2)          '208, 32, 144
    PDF.DrawText 50, 110, "PINK colored text"
    ' Save and show
    PDF.SaveToFile App.Path & "\test.pdf"
    Set PDF = Nothing
    ShellToDocument App.Path & "\test.pdf", False

' ************* END SAMPLE VB6 CODE **************

Can anybody shed any light on this?  Thanks in advance.  This isn't the only color:  most of the colors I can pick with non-0 and non-255 values for all three (RGB) don't show.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (1) Thanks(1)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 14 at 2:59AM
Chuck,

http://www.debenu.com/docs/pdf_library_reference/SetTextColor.php

SetTextColor

TextColor

Description

Sets the color for any subsequently drawn text. The values of the color parameters range from 0 to 1, with 0 indicating 0% and 1 indicating 100% of the color.


In other words, the values for the SetTextColor function are floating point values between 0.0 and 1.0 and not 0 and 255.

Andrew.
Back to Top
ChuckS View Drop Down
Beginner
Beginner


Joined: 10 Feb 14
Location: Illinois
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote ChuckS Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 14 at 1:50PM
Thanks, Andrew.  I must have read that page at least twice, but it obviously never sunk in!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store