Select to view content in your preferred language

Export PDF VB.net

418
0
01-10-2011 05:58 AM
RicardoMontero1
Emerging Contributor
Hello,

      I am developing with ArcGIS API for Microsoft Silverlight, WPF v2.0/VB.net 2010 and I need to export to pdf my map.

   I have a breakthrough but so far not been able to capture the variable map.


        Dim savePDF As New SaveFileDialog()
        savePDF.Filter = "PDF file format|*.pdf"
        If savePDF.ShowDialog() = True Then



            Dim document As New PdfDocument()
            Dim page As PdfPage = document.AddPage()
            Dim gfx As XGraphics = XGraphics.FromPdfPage(page)

            Dim options As XPdfFontOptions = New XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always)
            Dim font As XFont = New XFont("Huxtable", 20, XFontStyle.Bold, options)

            'Dim stm As Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Examples.pic1.jpg")
            'Dim img As Image = Image.FromStream(stm)
            'Dim w As Integer = img.Width * 2
            'Dim h As Integer = img.Height * 2
            'Dim rc As Rectangle = New Rectangle((pg.Width - w) / 2, (pg.Height - h) / 2, w, h)
            'gr.DrawImage(img, rc)
            'gfx.DrawImage(MyMap, New XRect(0, 0, page.Width, page.Height))

            gfx.DrawString("PRUEBA", font, XBrushes.Black, New XRect(0, 0, page.Width, page.Height), XStringFormats.Center)

            document.Save(savePDF.OpenFile())
        End If




from already thank you very much for your help

Greetings from Chile
0 Kudos
0 Replies