Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue May 08, 2018 4:22 pm

Drawing a string using this:
Code: Select all
Sp.PdfDocument pdfDoc = new Sp.PdfDocument(inputFilePath);

foreach (Sp.PdfPageBase page in pdfDoc.Pages)
{
   page.Canvas.DrawString("some text", new Sp.Graphics.PdfFont(Sp.Graphics.PdfFontFamily.Courier, 18f), Sp.Graphics.PdfBrushes.Transparent, 10, 10);
}

pdfDoc.SaveToFile(filePath)


results in the string being drawn in the color black. Is there something else that needs to be done in order for the string to be drawn transparent? My aim was to have invisible text that can still be highlighted.

prw56
 
Posts: 3
Joined: Mon May 07, 2018 7:31 pm

Wed May 09, 2018 3:36 am

Hello,

Thanks for your post.
I have reproduced the issue you mentioned and logged it in our bug tracking system.
Once there is any update, i will let you konw.
In addition, there is a workaround, you could draw the invisible text by setting the same color as the background color. If the backgroud color is white, you could set the text color as white with the setting PdfBrushes.White.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Mon May 21, 2018 7:04 am

Hello,

After an indepth investigation,sorry to tell you that the code cannot set text transparency because there is no text transparency in the PDF standard.
In addition, can the workaround I proposed before solve your problem?

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Fri May 25, 2018 8:25 am

Hello,

Greetings from E-iceblue.
How is the issue going?
Your feedback will be highly appreciated.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Return to Spire.PDF