Hi to everyone, I'm trying migradoc and pdfsharp in my .NET project. I created a test project with the above code copied and adapted from c# sample. When I try to execute it I receive the ArgumentOutOfRangeException on this line: pdfr.RenderDocument()
Could you help me to find the problem?
Thank you very much!!
Code:
Imports PdfSharp
Imports PdfSharp.Drawing
Imports PdfSharp.Pdf
Imports PdfSharp.Pdf.IO
Imports MigraDoc.DocumentObjectModel
Imports MigraDoc.Rendering
Imports MigraDoc.DocumentObjectModel.Tables
Public Class ReportTest
Public Sub New()
Me.create()
End Sub
Public Sub create()
Dim document1 As Document
document1 = New Document()
Dim tableBorder As Color = New Color(81, 125, 192)
Dim tableBlue As Color = New Color(235, 240, 249)
Dim tableGray As Color = New Color(242, 242, 242)
document1.Info.Title = "Test report Condotte"
document1.Info.Author = "Leo"
Dim style As Style
style = document1.Styles("Normal")
style.Font.Name = "Verdana"
style = document1.Styles.AddStyle("Table", "Normal")
style.Font.Name = "Verdana"
style.Font.Size = 10
Dim t As Table
Dim section As Section
section = document1.AddSection()
t = section.AddTable()
t.Style = "Table"
t.Borders.Color = tableBorder
t.Borders.Width = 0.25
t.Borders.Left.Width = 0.5
t.Borders.Right.Width = 0.5
t.Rows.LeftIndent = 0
Dim c As Column
c = t.AddColumn("1cm")
c.Format.Alignment = ParagraphAlignment.Center
c = t.AddColumn("5cm")
c.Format.Alignment = ParagraphAlignment.Center
c = t.AddColumn("4cm")
c.Format.Alignment = ParagraphAlignment.Center
Dim r As Row = t.AddRow()
r.HeadingFormat = True
r.Format.Alignment = ParagraphAlignment.Center
r.Format.Font.Bold = True
r.Shading.Color = tableBlue
r.Cells(0).AddParagraph("Item")
r.Cells(0).Format.Font.Bold = False
r.Cells(1).AddParagraph("Test Report")
r.Cells(1).MergeRight = 2
' t.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 3, Color.Empty)
document1.UseCmykColor = True
Dim pdfr As PdfDocumentRenderer
pdfr = New PdfDocumentRenderer(True, PdfFontEmbedding.Always)
pdfr.Document = document1
pdfr.RenderDocument()
pdfr.Save("HelloWorld.pdf")
End Sub
End Class