تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تحويل النصوص الى PDF
#3
بالبداية انت بحاجة الى اضافة reference  الى مشروعك حمله من النت PDFsharp Assemblies
وهذا مثال بسيط بعد ان يتم استدعاء النيم سبيس الخاصة
PHP كود :
Imports System.IO
Imports PdfSharp
Imports PdfSharp
.Drawing
Imports PdfSharp
.Pdf

Public Class Form1

    Private Sub Button1_Click
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click

        Try
            Dim line 
As String
            Dim readFile 
As System.IO.TextReader = New StreamReader("Text.txt")
 
           Dim yPoint As Integer 0

            Dim pdf 
As PdfDocument = New PdfDocument
            pdf
.Info.Title "Text File to PDF"
 
           Dim pdfPage As PdfPage pdf.AddPage
            Dim graph 
As XGraphics XGraphics.FromPdfPage(pdfPage)
 
           Dim font As XFont = New XFont("Verdana"20XFontStyle.Regular)


 
           While True
                line 
readFile.ReadLine()
 
               If line Is Nothing Then
                    Exit 
While
 
               Else
                    graph
.DrawString(linefontXBrushes.Black_
                    New XRect
(40yPointpdfPage.Width.PointpdfPage.Height.Point), XStringFormats.TopLeft)
 
                   yPoint yPoint 40
                End 
If
 
           End While


 
           Dim pdfFilename As String "txttopdf.pdf"
 
           pdf.Save(pdfFilename)
 
           readFile.Close()
 
           readFile Nothing
            Process
.Start(pdfFilename)
 
       Catch ex As Exception
            MsgBox
(ex.ToString)
 
       End Try
 
   End Sub
End 
Class 
الرد }}}
تم الشكر بواسطة: ابو روضة , محمد كريّم , sendbad100 , sendbad100 , elgokr


الردود في هذا الموضوع
RE: تحويل النصوص الى PDF - بواسطة YousefOkasha - 28-07-18, 01:46 PM
RE: تحويل النصوص الى PDF - بواسطة aljzazy - 28-07-18, 08:19 PM
RE: تحويل النصوص الى PDF - بواسطة GameOver - 29-07-18, 07:55 AM
RE: تحويل النصوص الى PDF - بواسطة DOX.1 - 30-07-18, 12:25 PM


التنقل السريع :


يقوم بقرائة الموضوع: