PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Sep 28, 2024 5:22 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Wrong color
PostPosted: Fri Aug 06, 2010 12:26 pm 
Offline

Joined: Fri Aug 06, 2010 12:19 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong color
PostPosted: Sun Aug 08, 2010 9:03 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 345
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.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong color
PostPosted: Sun Aug 08, 2010 12:59 pm 
Offline

Joined: Fri Aug 06, 2010 12:19 pm
Posts: 2
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 ?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group