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 - On-the-fly color conversion (RGB -> Separation)
  FAQ FAQ  Forum Search   Register Register  Login Login

On-the-fly color conversion (RGB -> Separation)

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


Joined: 09 Jul 15
Location: Netherlands
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rob Quote  Post ReplyReply Direct Link To This Post Topic: On-the-fly color conversion (RGB -> Separation)
    Posted: 09 Jul 15 at 6:47PM
I need to find a way to get separation colors into my output PDF.
Fortunately QuickPDF supports separation colors. It's pretty straightforward:

PdfLib.AddSeparationColor('RDG_WHITE', 25, 25, 25, 25, 0); // add a separation color
PdfLib.SetFillColorSep('RDG_WHITE', 1); // set fill color to use the separation color
PdfLib.DrawBox(Left, Top, Width, Height, 1); // draw something with the separation color

On to the second part of the problem.
My PDF is generated using this code:

aCanvas := TCanvas.Create;
aCanvas.Handle := PdfLib.GetCanvasDC(Width, Height);
TemplateDoc.SVG.Draw(aCanvas, Rect(0, 0, Width, Height));
aCanvas.Free;
PdfLib.LoadFromCanvasDC(DPI, 0);

This also works fine.

Now for the actual problem:

Using Draw on a Canvas to generate output on a PDF page rules out the possibility of using separation colors (as far as I can tell), because internally the Canvas is first converted into a MetaFile object (which doesn't support named colors). Inside LoadFromCanvasDC the MetaFile is then drawn onto the PDF page using a Painter object (Painter.DrawImage).

The only solution I can think of is to somehow "hook" into the loop that paints the MetaFile onto the PDF page. Inside this loop I could look for a specific RGB color, $98918F for example, and each time an object is about to be painted with this color, I would call SetFillColorSep or SetLineColorSep, just before the object is drawn to the PDF, so that the object would then be drawn using the separation color instead of its RGB color.

But how to accomplish this? Is there a standardized way of hooking into this loop, like maybe an OnChanging event of some sort? If not, where exactly in the code is this "loop" that draws the MetaFile onto the PDF page?

I hope someone can point me in the right direction!
Many thanks in advance!
Back to Top
Rob View Drop Down
Beginner
Beginner


Joined: 09 Jul 15
Location: Netherlands
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rob Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 15 at 1:52PM
Never mind, I got it working. I can now do on-the-fly conversion of any rgb color into any separation color I need.
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