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!
SetTextColor doesn't always work |
Post Reply |
Author | |
ChuckS
Beginner Joined: 10 Feb 14 Location: Illinois Status: Offline Points: 5 |
Post Options
Thanks(0)
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. |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(1)
|
Chuck,
http://www.debenu.com/docs/pdf_library_reference/SetTextColor.php
SetTextColorDescriptionSets 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. |
|
ChuckS
Beginner Joined: 10 Feb 14 Location: Illinois Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Thanks, Andrew. I must have read that page at least twice, but it obviously never sunk in!
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store