Link to home
Start Free TrialLog in
Avatar of kdeutsch
kdeutschFlag for United States of America

asked on

Create PDF with ITextSharp DLL

Trying to create a PDF document with the reference site of 4guys from Rolla and am trying to replicate what they are doing however no document comes up for me, none is produced, what do i need to do to get a PDF to come up.

Imports iTextSharp.text
Imports System.IO
Imports iTextSharp.text.pdf

 Protected Sub lnkPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkPrint.Click
        Dim document = New Document(PageSize.A4, 50, 50, 25, 25)

        Dim output = New FileStream(Server.MapPath("MyFirstPDF.pdf"), FileMode.Create)
        Dim writer = PdfWriter.GetInstance(document, output)

        Dim welcome As Paragraph = New Paragraph("Hello World")


    End Sub
Avatar of kdeutsch
Flag of United States of America image


Ok, I see that it was saving to my drive location on web server, how can I make the document open up sos that they can save to location of their choice.
Avatar of Nasir Razzaq
Where are you looking for the file? Do you have write permission on the directory?
use a pdf printer and print to it.

set the settings on the pdf printer as default

I have persmisisons to wrie to the server location it wrote the file to, but users need to be able to save to their client and I do not have permissions to write to it.  So I just want to open the fiel and then they can save it themselves.
Avatar of kdeutsch
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial