Я хочу использовать pdffilewriter в VB.NET
Привет,
я хочу использовать PDFFileWriter в VB.net но это не работает.
У меня есть только пустая страница. У вас есть какие-нибудь примеры для VB.NET 2017 год?
Это хороший класс.
Спасибо
С наилучшими пожеланиями Фрэнк
Что я уже пробовал:
Вот моя небольшая тестовая программа:
Imports PdfFileWriter Imports System.IO Imports System.Drawing Public Class Form1 Dim ArialFont As PdfFont Dim FontSize As Double Dim Ascent As Double Dim Descent As Double Dim FontHeight2 As Double Dim Document As PdfDocument Dim CenterX As Double = 4.25 Dim CenterY As Double = 5.5 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim npfad As String = "" SaveFileDialog1.Title = "PDF speicher unter..." SaveFileDialog1.OverwritePrompt = True If SaveFileDialog1.ShowDialog = DialogResult.OK And SaveFileDialog1.FileName > "" Then npfad = SaveFileDialog1.FileName If UCase(npfad).EndsWith("PDF") = False Then npfad = npfad & ".PDF" End If Dim PDFDokument As New PdfDocument(PaperType.A4, False, UnitOfMeasure.Inch, npfad) 'PDFDokument.Debug = True Dim FontName1 As String = "Arial" Dim FontName2 As String = "Times New Roman" ArialFont = PdfFont.CreatePdfFont(PDFDokument, FontName1, FontStyle.Regular, True) Dim ArialNormal As PdfFont = PdfFont.CreatePdfFont(PDFDokument, FontName1, FontStyle.Regular, True) Dim ArialBold As PdfFont = PdfFont.CreatePdfFont(PDFDokument, FontName1, FontStyle.Bold, True) Dim ArialItalic As PdfFont = PdfFont.CreatePdfFont(PDFDokument, FontName1, FontStyle.Italic, True) Dim ArialBoldItalic As PdfFont = PdfFont.CreatePdfFont(PDFDokument, FontName1, FontStyle.Bold And FontStyle.Italic, True) Dim TimesNormal As PdfFont = PdfFont.CreatePdfFont(PDFDokument, FontName2, FontStyle.Regular, True) Dim PDFPage As New PdfPage(PDFDokument) Dim Contents As New PdfContents(PDFDokument) Dim left As Double = CenterX - 0.5 * 1 Dim Right As Double = CenterX + 0.5 * 1 Dim Top As Double = CenterY + 0.5 * 1 Dim Bottom As Double = CenterY - 0.5 * 1 Contents.DrawText(ArialFont, 10, 10, 10, TextJustify.Center, DrawStyle.Normal, Color.Black, "Hallo") ' save state Contents.SaveGraphicsState() Contents.SetLineWidth(0.1) Contents.SetColorStroking(Color.Black) Contents.SetColorNonStroking(Color.LightBlue) Contents.DrawRectangle(left, Bottom, 3, 3, PaintOp.CloseFillStroke) Contents.RestoreGraphicsState() 'PDFContents.SaveGraphicsState() 'Contents.Translate(1.1, 1.1) 'Dim TextBox As New TextBox(Width, 0.25) 'Dim PosY As Double = Height 'TextBox.AddText(ArialNormal, 10, "Hallo Welt") Dim nText As String = "Hallo Welt" Dim Breite As Double = ArialBold.TextWidth(25, nText) Dim Höhe As Double = ArialBold.LineSpacing(25) 'Stop Contents.SaveGraphicsState() Dim nBarcode As New Barcode128("2018-2928282") Contents.SetColorNonStroking(Color.Red) Contents.DrawBarcode(3, 7, 0.01, 1, nBarcode, ArialNormal, 8) Contents.SetLineWidth(0.01) Contents.BeginTextMode() Contents.SetColorStroking(Color.DarkBlue) Contents.DrawText(ArialBold, 25, 4, 9, TextJustify.Center, 0.02, Color.FromArgb(128, 0, 0, 255), Color.FromArgb(255, 255, 0, 0), "Hallo Frank") Contents.DrawLine(10, 10, 50, 20) Contents.EndTextMode() Contents.DrawRectangle(1, 1, 6, 9, PaintOp.CloseFillStroke) Contents.RestoreGraphicsState() PDFDokument.CreateFile() Process.Start(npfad) End If End Sub End Class