How can we create a PDF based on SQL data? - sql

i just wondered if any users could advise me what to google for, as im wanting to create a pdf after a user has submitted a vbscript form.
The form contains data which goes into a MYSQL database and once the user has submitted i would like to use the data to create a PDF.
I would probably be calling this from the vbscript, so i wondered how can i create the PDF from vbscript? Would i have to make an external call to some other program/website or something? Do we need Adobe Acrobat Professional and could it be installed on our server to allow us to systematically create PDFs on the fly?

You are looking for a PDF com component.
There are many of these around - anything that works with classic ASP will work.
This is one I used int the past - AspPDF.

we also use PDFCreator which is installed on the server and works like a printer. The output is a PDF.

Related

How to create pdf Template with the dynamic values

I am stuck in this task from a month ago so my last option is to post my query on stack-overflow.
I have to find a PDF Creation tool where i can crate my PDF Template and also i can assign a data source like sql server or any thing else. by which the sql server dynamic data can replace the value of pdf template Tags.'
I have tried many tools like Foxit and bulzip . But any of the tool does not meets my requirement. I must say I have completely stuck in this Task.
So Please give me appropriate solution . Immediate response will be appreciated.
If you want to create pdf in client side, you can try jspdf
If you are using php for server side, you can try mpdf.
Have a look at wkhtmltopdf. It's a very simple console utility that creates PDF from HTML. So basically you need to generate HTML markup. You can use some scripting language (PHP, python, etc.) or templating engine, depending on what exactly you want and what tools you are familiar with.
Create HTML/CSS markup for your template.
Define places where you want to put dynamic data, mark it
somehow.
Create script that will query database for your data and then
Either use search&replace in your script to place real data, or
copy whole HTML as a template using some templating engine (for
instance, PHP is itself a template engine, so you can basically
place save template as PHP file where real data is placed where
needed).

what format is most reliable for saving a history file from an application?

Good Afternoon,
I am in the process of developing in vb.net a simple “cheque printing” application which will allow users to fill in a few text boxes with the values that will be printed on a cheque.
When they hit the print button, the values will be sent to the printer, but I also want the values they input in the text boxes saved to a file, so like a history file of all the cheques that were created.
I am thinking to use either an access database or an excel spreadsheet as my history file, but I am not quite sure on which would be best.
Please note that in my environment storing this information in a SQL database is not an option and also this file will most likely be stored/accessed from the network.
The history file needs to be:
1.Stable (cannot corrupt easy)
2.Reliable
3.Easily exportable in case we need to export the information to one of our in-house systems.
4.editable from the application I am developing
Kindly advise,
A
XML. Save the data to DataTable object and then use the .WriteXML method to save it as an xml file. I'd advise creating a strongly-typed DataTable class for this, so that the XML can be exported with a reliable schema and imported easily.
If you are using different fonts, you could use a .rtf (rich text format) which will save the format of the text that you send to print... it is a universal file format, you can open it with open office, ms office, or any office suite you have...
Access will be best choice,
it's relational database and can make a form from this file to do what are you looking for without VB or any code.
Also you can access this file from network.
for more detail about setting for this file go to this link
http://goo.gl/bOfGp6
and you will find more options complete your work.
I would use a MySQL server. It's free.
XML is also good, but I hate sharing folders...

How do I upload an Excel sheet to a SQL table in a Lightswitch web client?

I have a lightswitch project in visual studio 2013, using vb.net. I would like the user to be able to click a button and have lightswitch find an excel file, and upload that file to a sql table according to a pre-determined column mapping.
My preference was to use the Office Integration extension for visual studio, which I got working with VS 2013 by downloading it from this link: http://www.ge.tt/71iuRQv/v/0
However, the documentation and examples for office integration seem to be very heavy on getting an excel spreadsheet into a display in the lightswitch web client, rather than into the sql data table, which is where I need it. Here are the examples I've been following:
http://blogs.msdn.com/b/bethmassi/archive/2012/07/18/new-and-improved-office-integration-pack-extension-for-lightswitch.aspx
Alternatively, I have an existing stored procedure, and I can request that the server call this stored proc by sending a web API extension from the client to the server. I have this working already for other stored procs, according to examples from Beth Masi and Paul van Bladel. (Stackoverflow won't let me post the links...)
The undesirable part of this approach is that the stored proc is old, and messy.
I've searched and searched, but have yet to find anyone approach this problem for VS 2013 with lightswitch. Any useful advice?
I've used the method detailed by Matt Sampson to store word files and it works very well. Since it just stores the raw binary it should handle Excel files just as well.
If you're creating the table in LightSwitch, use the Binary Type. If you use SQL create scripts use varbinary(MAX).
You need to create a custom Silverlight dialog box to gain access to the OpenFileDialog object. Then open the file in as a FileStream.
Finally, you need to add a handler for the closed method of the control and then show the control to the user. Most likely done in a button. This needs to be done on the main dispatcher.
The code examples are in C# but I just used one of the many available translators out on the web and copy/pasted the VB.NET code.
Another option might be to consider shelling out to the DTSEXEC run-time to execute an SSIS package to perform the upload - especially if the target Excel spreadsheets have predefined layouts and content data types.
Even simpler, you might be able to use the SQL Server BULK INSERT command to get the job done - although that would require a SQL Client connection to your database.
HTH

stream varbinary PDF file from SQL 2005 to browser using ASP

I have a commercial program that stores PDF files to SQL 2005. I would like to be able to search for (I have that part) and then display the PDF file in a browser. It's the 'display the PDF file' that I'm having trouble with. I am using HTTP/ASP and would prefer to continue that way. I don't know anything about ASP.NET, so that would not be helpful to me. Any help would be appreciated. Thanks.
The best option here is to implement a HttpHandler that fetches the binary data from your database and outputs it to the response stream. This is the most efficient method available in ASP.Net.
There are many questions about HttpHandlers on SO, so implementing one should be easy: https://stackoverflow.com/questions/tagged/httphandler
One thing you should be aware of is that you should set the correct content type so that the browser recognices the pdf document.

Method to generate pdf from access+vb6 or just sql 2005?

The setup:
Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf.
The only way I can think of is send a request from access to the sql server for a web page. Something like:
"http://sqlserver/generatepdf.php?id=123"
I'm trying to avoid the web page 'middle man'. Is there a way to generate the pdf in T-SQL? Anyone have any other ideas. I'm not looking for code, just methdology ideas.
Thank you
Save the form as a report, then use Access MVP Stephen Lebans free A2000ReportToPDF utility to convert it to a pdf file.
http://www.lebans.com/reporttopdf.htm
If they have Access 2007 they can download and install the free Microsoft Office 2007 Add-in to save documents as PDF or XPS.
http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
Microsoft's ReportViewer client can generate pdfs natively.
It works inside of web pages and windows forms/wpf apps. You can programmatically trigger the export as well. The only downside is that you'll need to basically redo your form as a report.
I must admit that I did not get it: you want to export an Access form and its data into a PDF file? Your form is basically graphics, not text, nor report. Do you mean that you want this form to be included as (for example) a .png file inside a PDF file or do you want it to be a full PDF file inheriting objects from the original form and allowing things such as text search and so on?