0% found this document useful (0 votes)
5 views2 pages

Save Annotated PDF with Arabic Text

Uploaded by

secpdivision
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Save Annotated PDF with Arabic Text

Uploaded by

secpdivision
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.

Click
If pdfDocument Is Nothing Then Return

Dim dlg As New SaveFileDialog()


[Link] = "PDF files|*.pdf"
[Link] = "[Link]"
If [Link]() <> [Link] Then Return

Dim originalPath As String = "C:\Users\army\Desktop\file-


example_PDF_500_kB.pdf"
Dim outputPath As String = [Link]

Dim pdf As [Link] =


[Link](originalPath,
[Link])

For pageIndex As Integer = 0 To [Link] - 1


If Not [Link](pageIndex) Then Continue For

Dim page As [Link] = [Link](pageIndex)


Dim scaleX As Double = [Link] / CDbl([Link])
Dim scaleY As Double = [Link] / CDbl([Link])

Using gfx As XGraphics = [Link](page)


For Each stroke In pageStrokes(pageIndex)
If [Link] Then
' --- Draw Arabic / RTL text as bitmap ---
Dim bmpWidth As Integer = 500
Dim bmpHeight As Integer = 100
Using bmp As New Bitmap(bmpWidth, bmpHeight)
Using g As Graphics = [Link](bmp)
[Link]([Link])
[Link] =
[Link]

[Link](g,
[Link],
New Font("Arial",
[Link] * 6),
New Rectangle(0, 0, bmpWidth,
bmpHeight),
[Link],
[Link] Or
[Link])
End Using

Dim xImg As XImage = [Link](bmp)


[Link](xImg,
[Link].X * scaleX,
[Link].Y * scaleY,
bmpWidth * scaleX / bmpWidth,
bmpHeight * scaleY / bmpHeight)
End Using
Else
' Draw pen / eraser strokes
Dim pen As New XPen(If([Link], [Link],
[Link]([Link]())), [Link])
For i As Integer = 1 To [Link] - 1
[Link](pen,
[Link](i - 1).X * scaleX,
[Link](i - 1).Y * scaleY,
[Link](i).X * scaleX,
[Link](i).Y * scaleY)
Next
End If
Next
End Using
Next

[Link](outputPath)
[Link]()
[Link]($"Annotated PDF saved with proper Arabic text: {outputPath}")
End Sub

You might also like