Link to home
Start Free TrialLog in
Avatar of Moiz Saifuddin
Moiz Saifuddin

asked on

create pdf

In a vb.net application(web app) how can i create a pdf file in runtime...




Moiz
Avatar of mikib10
mikib10

Hello
You can install PDF printer (Adobe Drivers) and print to this printer from your VB application, the result will be a PDF file.

Thanks.
Miki
Avatar of Moiz Saifuddin

ASKER

yea but dont i need to pay a certain amount of money to install the drivers...
can this work on websites too?
No,
On websites you should use PDF components.

Thanks
the link has all evaluation copies...
Check this out:
http://www.developerfusion.com/show/4266/
http://www.net-language.com/CodeExample.aspx?i=655
It's not soo simple (i.e. uses Crystal Reports to generate the PDF), but Crystal Reports is included with Visual Studio, so you probably already have it.

Otherwise your best bet is probably a 3rd party PDF component for ASP.NET, such as abcPDF - free (http://www.websupergoo.com/abcpdf-1.htm), PDF Creator Pilot (http://www.colorpilot.com/pdflibrary.html), PDF Component (http://www.edcomponents.com/EDComponents/Main.aspx?ProductID=1), etc. (there are alot). Most PDF-Components are payware as they are generally used by companies.

John

I tried out this site below...and creates the file for me, although it tells me when i open the pdf file to register the copy at the site below..do i need to pay for those...?

http://www.colorpilot.com/pdfsample_vbnet.html
ASKER CERTIFIED SOLUTION
Avatar of softplus
softplus

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

I tried out the Edcomponents website, i get this error below, i have the system.drawing file referenced below still i get this error, if you look all the way down below where it says PublicKeyToken=null , maybe thats something i need..and i am using web application not windows app

File or assembly name System.Drawing, or one of its dependencies, was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: File or assembly name System.Drawing, or one of its dependencies, was not found.

Source Error:


Line 28:
Line 29:     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 30:         Dim PDF As New EDComponents.PDF()
Line 31:         Dim Pagesetup As New EDComponents.PDF.PAGESETUP()
Line 32:         Dim Page As EDComponents.PDF.Page
 

Source File: C:\Inetpub\wwwroot\WebApplication46\WebForm1.aspx.vb    Line: 30

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Drawing' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Inetpub/wwwroot/WebApplication46
LOG: Initial PrivatePath = bin
Calling assembly : EDComponents.PDF, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.
===

 
this is the rest of the error log i got while running the app


LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file (C:\Windows\Microsoft.NET\Framework\v1.0.3705\aspnet.config).
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v1.0.3705\config\machine.config.
LOG: Post-policy reference: System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication46/3c4c9840/ff08c59b/System.Drawing.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication46/3c4c9840/ff08c59b/System.Drawing/System.Drawing.DLL.
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebApplication46/bin/System.Drawing.DLL.
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebApplication46/bin/System.Drawing/System.Drawing.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication46/3c4c9840/ff08c59b/System.Drawing.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication46/3c4c9840/ff08c59b/System.Drawing/System.Drawing.EXE.
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebApplication46/bin/System.Drawing.EXE.
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebApplication46/bin/System.Drawing/System.Drawing.EXE.

I have made it to work by downloading this redistributable fix of .net framework 1.1,
dont know how that works, so now i guess these guys will send me a key for registration when it gets released...

http://www.edcomponents.com/EDComponents/Main.aspx?MenuID=1
Yep, looked like it was having problems getting the .net files onto the server, I had that once in the beginning as well :). Just make sure you give the ED-Components guys some feedback on your usage + progress -- they mention that you'll get the full version if you report your comments to them :). Also, when writing files on the server, make sure you have r/w access to the directory (with your IUSR_ Account), otherwise it won't work. Good Luck!
John