logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Mikhael  
#1 Posted : 3 years ago
Mikhael

Rank: Newbie

Groups: Registered
Joined: 4/7/2021(UTC)
Posts: 6
Russian Federation

Hello,

I cannot add russian text to PDF file with bold and italic flags.

CreateFont() usage let me add russian text, but it ignored bold and italic flags.

CreateWindowsFont() can process bold and italic flags correctly, but is unable to put russian letters.

123.pdf (4kb) downloaded 1 time(s).

My code snippet is:
---
Dim srcPDF = "E:\test files kit\pdf\EMPTY.pdf"
Dim dstPDF = "D:\out\123.pdf"
Dim sLabelText = "321 проверка шрифта 123"

Using pdfFile = PdfDocument.Load(srcPDF, New PdfForms())
For Each pdfiumPage In pdfFile.Pages

Dim font01 = PdfFont.CreateFont(pdfFile, "Arial", True, FontFlags.PDFFONT_ITALIC, FontWeight.FW_BOLD, 0, FontCharSet.UNICODE_CHARSET, False)

Dim lf As New LOGFONT() With {
.lfCharSet = FontCharSet.UNICODE_CHARSET,
.lfFaceName = "Arial",
.lfItalic = True,
.lfWeight = FontWeight.FW_BOLD,
.lfClipPrecision = LOGFONT.FontClipPrecision.CLIP_DEFAULT_PRECIS,
.lfOutPrecision = LOGFONT.FontPrecision.OUT_DEFAULT_PRECIS,
.lfQuality = LOGFONT.FontQuality.DEFAULT_QUALITY,
.lfPitchAndFamily = LOGFONT.FontPitchAndFamily.DEFAULT_PITCH
}

Dim font02 = PdfFont.CreateWindowsFont(pdfiumPage.Document, lf, False, True)


Dim fillColor = New FS_COLOR(128, 255, 0, 0)

Dim wmTextObject01 As PdfTextObject = PdfTextObject.Create(sLabelText, 0, pdfiumPage.Height / 2, font01, 10)
wmTextObject01.FillColor = fillColor

Dim wmTextObject02 As PdfTextObject = PdfTextObject.Create(sLabelText, 100, 100, font02, 12)

pdfiumPage.PageObjects.Add(wmTextObject01)
pdfiumPage.PageObjects.Add(wmTextObject02)

pdfiumPage.GenerateContent()
Next

pdfFile.Save(dstPDF, SaveFlags.NoIncremental)
End Using
---
Paul Rayman  
#2 Posted : 3 years ago
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,116

Thanks: 8 times
Was thanked: 130 time(s) in 127 post(s)
You must use the font name ArialBold instead of Arial

Edited by user 3 years ago  | Reason: Not specified

Mikhael  
#3 Posted : 3 years ago
Mikhael

Rank: Newbie

Groups: Registered
Joined: 4/7/2021(UTC)
Posts: 6
Russian Federation

This trick doesn't work, unfortunately.

Mikhael
Users browsing this topic
Guest
Forum Jump  
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.