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!
![]() |
On-the-fly color conversion (RGB -> Separation) |
Post Reply ![]() |
Author | |
Rob ![]() Beginner ![]() Joined: 09 Jul 15 Location: Netherlands Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() 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! |
|
![]() |
|
Rob ![]() Beginner ![]() Joined: 09 Jul 15 Location: Netherlands Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Never mind, I got it working. I can now do on-the-fly conversion of any rgb color into any separation color I need.
|
|
![]() |
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