Open PDF and print to PDF programmatically C# - c#

I am developing an application that is able to open and display PDFs after I open them and print them to another PDF using CutePDF, but the originals are not viewable.
I am looking for a way to programmatically open a PDF file, and print to another PDF file (not necessarily using CutePDF, just printing to another PDF is the desired functionality).
This will be integrated into a C# .NET project. Are there any suggestions how to go about doing this?
Thanks.

You could use Office Interop and generate the PDF, when you say "print to another pdf", I imagine you mean just generate? Or are you saying spool them to a pdf print driver that essentially will just create a PDF to be saved.

Use iText, which is available in Java and C# versions. I have used the Java version successfully. I recommend the iText in Action book to help you get up to speed with iText faster. The book discusses only the Java API, but I imagine you will be able to learn the principles of iText from the book and then figure out the minor differences for the C# version.

To implement this you can use PDFFlow library for generating PDF files from C#. It has easy fluent syntax and many features.
Here are many examples of real complex PDF documents: examples
Good luck :)

Related

printing in WPF - making your own 'bill' - any directions?

I am wondering the best way to make bills, or reports or anything printing related in WPF. I am thinking of using iTextSharp but I wanna see what other ways are there. Can anyone here direct me in the right way? Thanks in advance!
If you are coding for POS(Point Of Sale) System, then you can use System.Drawing.Printing Library for printing bill, which is really fast.
For reports, use crystal reports for dynamic pdf reports generation because you can export it to pdf, excel and rpt.
The OpenXML SDK is Microsoft's own library for working with Office (> 2007) documents: http://www.microsoft.com/en-gb/download/details.aspx?id=30425 . It's reasonably straightforward to use, and comes with the handy 'OpenXMLSDKTool' which takes existing Office files and creates the source code required to generate them.

How to convert Word documents (XML based) to PDF, with C#?

I have to do some automation of converting Word documents to PDF. By doing some research, I found that starting from Microsoft Office 2007, Word documents are XML based. Furthermore, I found that there is a free solution ApacheFOP doing conversion from XML to PDF, however, I still didn't manage to find the way to automate it with C#. There is nFOP (version that runs on the .NET framework), but some detailed explanation of implementing it, not really.
You could use docx4j.NET
That's a .NET version of docx4j, which is a Java library which converts docx to PDF using FOP.
See ConvertOutPDF.java
Before you go to the effort of downloading etc, you might want to use the online demo to see whether the PDF output is close to your needs.
**Disclosure: I lead the docx4j project. **
An ugly solution would be to make a "save as" using microsoft office interop...
Read more here
And find the related stackoverflow post here
I have found one library that can convert XML to PDF in C#/.NET and vice versa known as Aspose.PDF for .NET . I hope it will solve your problem.

create ppt programmatically using C# [duplicate]

Is there a way to programmatically create PowerPoint presentations? If possible, I'd like to use C# and create PowerPoint 2003 presentations.
Yes, you can.
You will want to look into MSDN which has a pretty good introduction to it.
I might give you a word of warning, Microsoft Office interop is compatible with an API which is now more than 10 years old. Because of this, it is downright nasty to use sometimes. If you have the money to invest in a good book or two, I think it would be money well spent.
Here's a starting point for you. Use the search feature on MSDN MSDN Webpage. It's good for any Microsoft C# .NET style stuff.
Specifically in regards to your question, this link should help: Automate PowerPoint from C#. EDIT LINK NOW DEAD :(. These two links are fairly close to the original KB article:
Automate Powerpoint from C# 1/2
Automate Powerpoint from C# 2/2
Finally, to whoever downvoted this: We were all learning one day, how to do something as a beginner is most definitely programming related, regardless of how new someone might be.
OpenXML looks like the way to go from a web app.
Using the interop libraries is not recommended, as others have stated.
You can also look at Aspose Slides, a component for .NET and Java that makes it easy to generate powerpoint documents.
If you don't really need PowerPoint compatible output, consider using a markup language such as LaTeX with the Beamer package to produce a PDF of the presentation, or use HTML and javascript in a manner similar to Slidy. If you need fancy effects, it might still be easier to use SVG, and you'd have the benefit of getting output that can be reliably viewed with free software.
http://msdn.microsoft.com/hi-in/magazine/cc163471(en-us).aspx
Use this link. Although this is in VB.NET, C# supports the same.
You may also try out SlideMight, a tool for merging hierarchical data with PowerPoint templates.
SlideMight supports:
text substitution in text fields, tables and notes
image substitution, from raw data, files and URLs
images in tables nested
iterations over data to create slides
iterations to populate tables, possibly spanning multiple slides
special formatting for specific cell values
hyperlinks to generated slides
Input data format is at this time just JSON.
There are versions for Windows and Mac OS X.
More information is at http://www.SlideMight.com
Disclaimer:
I am the owner of Delftware Technology, the company that developed SlideMight.
And I am one of the developers.
You can use Essential Presentation product from Syncfusion Software Private Limited. This product can be used to
Create and manipulate PowerPoint presentations
Open, modify, and save existing PowerPoint presentations
Convert PowerPoint presentations to PDF or Image
More information is at https://help.syncfusion.com/file-formats/presentation/overview
Disclaimer:
I work for Syncfusion Software Private Limited

Extract text form pdf using Foxit SDK

I am using Foxit SDK to extract the text from Pdf document .
Everything is okay but when I extract a pdf in other languages rather than English I don't get the correct output .
I have also used PDFBox in java but that gives me the worst output, output from Foxit SDK is better than PDFBox.
Are there ant other libraries which can solve the issue..?
Or there is some other solution.
Personally if you want it done right you have to pay for it. ComponentOne has a PDFViewer for WPF. Not sure what framework your working with since your tag is missing one.
ComponentOne PDF Viewer for WPF
You might want to try the trial version of Quick PDF Library to see how it performs on your documents. http://www.quickpdflibrary.com
QP.GetPageText(7) or GetPageText(8) returns pretty good results for most PDF files.
Andrew.
Disclaimer: I do some consulting work for Quick PDF Library.
If you are on windows, you can use the IFilter that adobe provides. Me, I used the IFilter adobe provides with the adobe reader 8.
Here is a link to the exact example I used
http://www.codeproject.com/Articles/13391/Using-IFilter-in-C
The performance was okay (I think. I haven't used many other methods). Takes about 15 sec for a 400 page PDF.

HTML Printing

I am too cheap to buy crystal reports so i built the report in asp.net, the only problem I'm facing is printing the report and making it look professional. On different printer's the report looks diff, i want to be able to control the final output and make the report print standard across all printers. You guys have any suggestions on how to achieve this properly?
Why not just use Reporting Services? It's free and easy to integrate with both WebForms and WinForms apps. Supports export to PDF, Excel, etc.
Mabye a stylesheet? Google it, good luck
You could try implementing a print stylesheet (you'll find many examples Googling the term), but that can be laborious if you're not familiar with css.
If you're checking out pdf solutions, I've used iTextSharp to create pdfs. It's relatively easy, open source and mature and used by many corporations.
You could try printing to a PDF. Not sure what your budget is, but ExpertPDF is a good option I'm using now.
You could create the report as a PDF using a C# library such as PDFsharp (Open-Source).
This approach allows you to:
Serve PDF files to your user, giving them the option to:
print it now
archive it for later use
Automatically email reports to your users using a scheduled task
Store generated PDFs in a database or on the file system
cutePDF is a free PDF writer and should work for what you need

Categories