PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Wrong color
http://forum.pdfsharp.com/viewtopic.php?f=2&t=1291
Page 1 of 1

Author:  ZeK [ Fri Aug 06, 2010 12:26 pm ]
Post subject:  Wrong color

Hi,
i'm having some problem editing a document.

I'm trying to draw a black text using XGraphics.DrawString and XBrushes.Black. The text drawn on my PDF is grey, the color is actually RGB(146, 146, 146).
I also tried new XSolidBrush(XColor.FromArgb(0, 0, 0)), the result is exactly the same.

If i draw the same text on a new PdfDocument(), the text is black.

Someone knows what is wrong ?

Thanks.

Author:  () => true [ Sun Aug 08, 2010 9:03 am ]
Post subject:  Re: Wrong color

ZeK wrote:
Someone knows what is wrong?

How can we answer that without seeing the PDF file or your code?

There could be a white, transparent rectangle over the text or something like that.

Do you append the text or prepend it?

It could help to activate the Transparency Grid in Adobe Reader (Settings, Display Settings).
Compare the grids of your "black text PDF" and your "grey text PDF".

Please also try "XSolidBrush(XColor.FromArgb(1, 1, 1))". If the problem originates in PDFsharp, this might work as expected.

Author:  ZeK [ Sun Aug 08, 2010 12:59 pm ]
Post subject:  Re: Wrong color

Thanks for the answer.

First, it's not a transparency problem, when i edit the text width Acrobat, in properties the color is RGB(146,146,146).

Second, here is my code so you can see exactly what i'm doing :
Code:
this.stats = PdfReader.Open("C:/foo/stats.pdf", PdfDocumentOpenMode.Modify);
this.graphics = XGraphics.FromPdfPage(this.stats.Pages[0]);
this.graphics.DrawString(
                    "04/08/2010",
                    new XFont("Arial", 9),
                    new XSolidBrush(XColor.FromArgb(1, 1, 1)),
                    new XRect(this.x, page.Height - this.y, this.width, this.height),
                    XStringFormats.Default);

this.stats.Save("C:/foo/result.pdf");


Finally, using XColor.FromArgb(1, 1, 1) worked like a charm (though it's not exactly black).

Would you like me to PM you the files stats.pdf and result.pdf to see what's exactly going on in PDFSharp ?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/