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 - change color
  FAQ FAQ  Forum Search   Register Register  Login Login

change color

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


Joined: 10 Apr 14
Location: Germany
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote juergen Quote  Post ReplyReply Direct Link To This Post Topic: change color
    Posted: 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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
juergen View Drop Down
Beginner
Beginner


Joined: 10 Apr 14
Location: Germany
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote juergen Quote  Post ReplyReply Direct Link To This Post 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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
juergen View Drop Down
Beginner
Beginner


Joined: 10 Apr 14
Location: Germany
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote juergen Quote  Post ReplyReply Direct Link To This Post 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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 14 at 3:27AM
Juergen,

It is not easily possible as the capture page contains its own SetFillColor and SetTextColor commands.

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.
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