allowing the user to create PDF documents - asp.net

I am new to the PDF generation but have a project to do. In my project the user should be able to create PDF documents. I have searched a lot a found sites/tutorials on creating PDF documents using itextsharp. But they have shown examples of creating simple PDF documents i.e. hello world.
What I want is blank editor(for that am using ckeditor) and user write data into that blank editor and when user clicks on save button file should get saved in PDf format. How can I do so?

This can help you as PDFSharp provides more function for PDF
PDF samples

This could get tricky if you want to preserve all the formatting that was entered into CKEditor.
From my experience the two best PDF generation libraries are iTextSharp and syncfusion. Of the two I feel syncfusion can be easier to work with.
Basically what you'll want to do is parse your HTML and generate a similar PDF structure. Both iText and syncfusion can go straight from HTML to PDF, but if your html has an odd layout you might have to form up the PDF by hand (Using PdpPTables, Paragraph objects ect).

Related

Insert a pdf file in a QTextDocument and then printing the result

I was wondering if the following is possible. I want to write an report writing tool. So the idea is that some one fills the blanks, adds the information in some sort of simple text editor, they press a button and presto! A report with proper headings and a uniform standard is generated. However there is one problem that I need to solve before I dive into this. The tool must allow the inclusion of other pdf files, and from what I've been reading this is not possible. Here is an Example of what I want:
Some rich text.
Annex I
datasheet.pdf
Some more reach text.
What I want is for the datasheet.pdf to be inserted as is a that approximately that point in the final pdf file (so page numbering and so on can be consistent). Is this possible? If so any idea how?
Thanks for any answers!
As ddriver mentioned, Qt doesn't directly support opening PDF files for editing purposes. Here is a useful link which discusses various available options for working with PDFs in Qt.

Generate a PDF view with data for printing

I'm currently working on a project that requires me to generate a printable report. I'm using a PDF reporting I found in code project, you can click here: PDF Reporting to get a better view.
The thing is that the report that I need to produce already has a form that needs to be followed that can be found here: FORM. I was planning on placing the form as a background image through CSS3, place the necessary data over the image and throw it to the PDF reporting controller. Problem is that when the pdf view has been generated, the background image is missing. Is it possible to actually pass an image to this PDF reporting? I already tried placing an img tag as mentioned in the site but it didn't work.
Is this a good solution or is it better if we recreate the form from scratch. If you have other approach to this problem, I'd be glad to hear your suggestions.
Oh and by the way, we are using mvc3, razor view.
Update: We are also using entity frame work and asp.net 4.1
Thanks in advance!
I would suggest you to think about Microsoft Report Viewer.
You have a proper designer, very easy to use, and you can generate PDF files as well.
You can find a good tutorial here.
In your situation it would be better to map each field of the report as a parameter so you do not have to create a dataset.

Create pdf document in asp.net 2.0

I am using asp.net 2.0 with c#.
I have to convert my label text into pdf. For this I have used this tutorial
http://www.codeproject.com/KB/aspnet/Creating_PDF_documents_in.aspx
now I am facing two problems:
Every time it is creating 1.pdf, what if there are so many user wants to see the the pdf format of any page
As my label text contains HTML content, it is showing a HTMl output. I don't want HTML to be display in the pdf.
please let me know if you have any other way to create a pdf.
Thanks in advance.
Creating a PDF with HTML-formatted content is not entirely trivial, and the CodeProject sample code isn't quite suitable for that. You'll most likely want to look into a (commercial) third-party solution for this: I myself use Siberix Report Writer: it's flexible, quite affordable, works in partial-trust scenarios (nice for shared web hosting environments) and most importantly doesn't require a per-server license, so you can embed it in your product without redistribution issues.
Item 1) You cache your pdf files to disk. When a request is made for a pdf check if the pdf has been created (i.e. there is a file on disk) and if not generate it. Then send the pdf using the response.writefile command
Item 2) If you are trying to print formatted html into pdf then you will need something that is capable of rendering html. There are a number of html to pdf converters however I have not found them to be all that good. If you are comfortable with php then there are some pretty good converters you can use. Joomla supports html to pdf, so whilst it may not be the exact solution it maybe a good starting point.
I would also suggest you take a look at Aspose PDF.
I would suggest using RDLC Report or Crystal Reports as suggested by #Jeroen
Cete Pdf Generator has HtmlTextArea element and supports some limited HTML
http://www.cete.com/support/net_help_library/html/ceTeDynamicPDFPageElementsHtmlTextArea.htm
ABCpdf is another commercial component which converts html to pdf.
http://www.websupergoo.com/abcpdf-5.htm
You could try the itextsharp library. I've not used it but it has been highly commended by other developers I know. http://sourceforge.net/projects/itextsharp/
In regards to the caching issue. I would check the file system for a pdf named via a convention. If the file is found then serve it. Otherwise, call another method which generates the pdf and saves it to the drive. This way only the first ever request will cause the generation of the pdf. Naming conventions will be key here. The basic implementation wont be thread safe. But it's a good start.
I use CrystalReports. It can create a PDF on the fly and output it to disk or http directly.

Merging document with OpenOffice from flex (air)

i'm searching a method to merge some data from an air application to a template made with word (.doc).
I've search on the web for exemple, look at the open office API, but did'nt find anything.
1- do you think it's possible from air to make a document (pdf as possible) from a existing template in .doc ?
If not, i read that livecycle can do pdf from template (template in pdf, with xsd to do the relation beetween data and template) but do know a simple way to convert existing template in .doc to template in pdf?
Every clues will be welcome to help us.
Thanks !
It's possible to make a pdf document with AlivePDF but I don't think it's currently possible to open a .doc file, maybe a .docx since its basically a xml in a zip file.
I don't think a word document as a template would be a good choice, I would recommend using an image.

Creating interactive reports in PDF

I want to create reports that can be drilled down by the readers - but the reports have to be PDF. I have two options:
Link from the PDF to an online report tool
Make the reports themselves interactive
I like #2...
I believe I can do this with Adobe AIR (Flex, Flash + Adobe Reader 9 or higher).
There are tools that can create PDF documents programatically (AIR?, AlivePDF)
There are frameworks in Adboe that are ideal for reports and charts (Flex)
And PDF documents can contain flash content (Adobe Reader 9+)
My questions are:
If I have an interactive Flash component in a PDF document and I go to print, what will print? Will the current view of he Flash print?
If I want to drill down, all the data has to be in the PDF document (it has to be stand alone). This is fine... but how to do I put the data in the PDF programatically? Is this done with Flex and AlivePDF?
I saw an online sample of an interactive charting report in a PDF document, but now I can't find it. :( I would love to find something again if you know of one.
I feel that I may have all the pieces, but not understanding correctly how they all go together. Any ideas?
Answer to question 3: Currently AlivePDF does not allow you to embed Flash content into a generated PDF. The generated PDFs can include text, images, simple graphics, and certain non-visual features such as bookmarks.
PDF's have JavaScript as a native control language now. With it, you can embed "links" that jump to other pages, etc.
Theoretically, you can call web services from within a PDF using JS and process the responses, perhaps even dynamically filling page areas.
BUT
PDF's are good for providing a document that looks and prints the same everywhere. They are also good for fill-in forms. They are NOT built for "drill-down" on the client side. Can you check the goals of the project to see why they want dynamic PDF's ? If they want portability (i.e. without a web connection), perhaps you can give them what they want with an AIR application and an XML file.
Cheers
we developed interactive content reports for PDF/flashpaper/etc using flex as a front-end but handle the actual report creation server-side using coldfusion's cfdocument/cfpdf (or Itext if we really need insane levels of placement/control/etc.). basically the user chooses the content & the cf app on the backend lays it out & sends back the report.

Resources