SetTextColor doesn't always work
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2825
Printed Date: 02 Jul 25 at 1:51AM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: SetTextColor doesn't always work
Posted By: ChuckS
Subject: SetTextColor doesn't always work
Date 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.
|
Replies:
Posted By: AndrewC
Date Posted: 11 Feb 14 at 2:59AM
Chuck,
http://www.debenu.com/docs/pdf_library_reference/SetTextColor.php
SetTextColor http://www.debenu.com/docs/pdf_library_reference/Text.php" rel="nofollow - Text , http://www.debenu.com/docs/pdf_library_reference/Color.php" rel="nofollow - Color DescriptionSets 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.
|
Posted By: ChuckS
Date Posted: 11 Feb 14 at 1:50PM
Thanks, Andrew. I must have read that page at least twice, but it obviously never sunk in!
|
|