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.

Sat Dec 14, 2024 3:40 pm

Hello,
I am developing a desktop program with Windows 11, VB.Net.
I'm using FreeSpire.PDF 8.2.0.

Dim doc As PdfDocument = New PdfDocument()
doc.LoadFromFile(xxx.PDF)
doc.Print()

I print pdf as follows.

How can I make the page Bold while writing?

Thank you.

BySerkan
 
Posts: 1
Joined: Tue Oct 06, 2020 12:10 pm

Mon Dec 16, 2024 2:46 am

Hello,

Thanks for your inquiry.

When printing, bold formatting cannot be directly applied to the page. However, you can achieve a bold appearance by using a bold styled font when adding text. Below is an example code snippet:
Code: Select all
Dim doc As New PdfDocument()

' Create one page
Dim page As PdfPageBase = doc.Pages.Add()

' Create a TrueType font using Arial with bold style.
Dim font As New System.Drawing.Font("Arial", 15.0F, FontStyle.Bold)
Dim trueTypeFont As New PdfTrueTypeFont(font)

' Draw the text
page.Canvas.DrawString("Hello, World!", trueTypeFont, New PdfSolidBrush(Color.Black), 10, 10)

Dim result As String = "HelloWorld.pdf"

' Save the document
doc.SaveToFile(result)
doc.Close()


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Fri Dec 20, 2024 9:16 am

Hello,

Hope you are doing well.

Can the above solution help you?

I'm looking forward to receiving your feedback soon.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron