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!
![]() |
change color |
Post Reply
|
| Author | |
juergen
Beginner
Joined: 10 Apr 14 Location: Germany Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Topic: change colorPosted: 10 Apr 14 at 10:04AM |
|
Hello,
i try to open a existing pdf and write it into a new pdf (DrawCapturedPage) but the textcolor & fillcolor must be set to RED (because its a failure notice). SetTextColor & SetFillClor makes no changes. Does anybody know, what I'm doing wrong? Regards Jurgen
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 Apr 14 at 4:10PM |
|
Juergen,
CapturePage / DrawCapture page will copy the page as is and redraw it as is at a different scale or size. Setting TextColor / FillColor will not change the existing text in the PDF. You need to add extra content using DrawText / SetTextColor / SetFillColor. Can you try the following code on your PDF. QP.LoadFromFile("before.pdf"); QP.SelectPage(1); QP.NormalizePage(0); QP.SetTextColor(1, 0, 0); QP.AddStandardFont(4); QP.SetTextSize(30): QP.SetOrigin(1); QP.DrawTetxt(72, 72, "Hello World"); QP.SaveToFile("After.pdf"); Andrew.
|
|
![]() |
|
juergen
Beginner
Joined: 10 Apr 14 Location: Germany Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 14 at 10:50AM |
|
Hello Andrew,
thx for your answer and sorry for my delayed reply (I was ill). Using your code I get a red new text - is ok, but my text is still black. I tried it with setfillcolor & settextcolor and got the same results. What can I do? Juergen
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 12 May 14 at 3:35AM |
|
Juergen,
It sounds like you want the existing text inside the CapturePage to be turned to red. This is not possible. You can only add RED text to an existing PDF. Andrew.
|
|
![]() |
|
juergen
Beginner
Joined: 10 Apr 14 Location: Germany Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: 12 May 14 at 8:35AM |
|
Hello Andrew,
yep, thats the job I have to do. I get a failure notice as pdf file and have to copy it, as a new frame, into another pdf, but it must be there in red color. Is it not possible to change a seperate content into a different color, like "print as black&white" ? regards Juergen
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 14 May 14 at 3:27AM |
|
Juergen, You would need to manually parse the content stream for the page and change all the color commands from black to red. You would need to use GetContentStreamToString and SetContentStreamFromString to extract the drawing comments and then you would need to change any '0 0 0 rg' strings to '1 0 0 rg' to change things to red. There are other commands that would need changing. This is assuming that the PDF is in RGB format and not CMYK and that it is using true black and so on... You might get lucky. QP.ReplaceTag( '0 0 0 rg', '1 0 0 rg'); // might work. No guarantees. QP.ReplaceTag( '0 0 0 RG', '1 0 0 RG'); // might work. No guarantees. Andrew.
|
|
![]() |
|
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