c# printing PDF in Multiple setting output? - c#

I have a .net application in c# where I'm trying to print using a pdf document on the left side and a text description on the right side. So far I've been successful in combining the 2 outputs into one pdf file, but am stumped on how to programmatically do it so that when I go to print, then in the Page Sizing & Handling section, select "Multiple" and set pages per sheet to 2.
My guess is it's a process print feature somewhere but can't seem to find any examples nor clear documentation to do so. Please advise, thanks.

if you want to set pages per sheet from the backend rather than print/ print dialog you have to use PrintTicket Class [System.Printing]. this classs have lots of property and events that can allow us to do lots of printing and printing job related stuff using c# code. there is also many classes related to printing in this name space[ may you know about the xps in windows when you going to print may you see option print to xps it is belongs to Print Schema class]
you can read more about it from https://msdn.microsoft.com/en-us/library/system.printing.printticket.aspx

Related

ASP.NET c# Creating a PDF (both Rotativa and ITextSharp) how to modify the ViewerPreferences dictionary to turn off print scaling in adobe readier

We are generating PDFS from a web app a couple different ways, ItextASharp, Html->Rotativa, and RDLC...
Is there any way in anyof those tools to modify the ViewerPreferences dictionary inside the PDF so as to disable the "shrink to fit" option..
The PDF format supports this option, I've found documentation for that...
I'm aware that not all viewers honor the request not to shrink to fit, but we're using stock adobe readers across the board so it's ok.
I was able to find this in ITextSharp to read one, modify it and save, it, so I have to believe there is a way to set it before generation...but I can't find it..
Determine properties such as if PDF is Simplex or Duplex in iTextSharp
It'd be awesome if Rotativa had a way too...since we use that for some reports
We also have some done in RDLC style, if there is a way to do it there...
The reason we have to do it, is one of our apps prints labels and the amount of data leave no room for fudging it. Printing them from a web app is problematic, even when we control the ecosystem.
Unfortunately, our IT group will not use the reg settings to change the default on the machines.. we have to do it through code.

edit pdf document checkboxes and fields in c#

I would like to know how can I edit an existing PDF document in C#. The document is already created and has fields as the one on the image below:
I want to know if there is a code which can check the desired checkbox or enter text at the lines. Please let me know.
I looked at iTextSharp but I don't know if that tool can help me achieve that.
There are ways to do it, but it requires external tools. I use ActivePDF library, it provides form filling routines and works quite well..
You can do that with iTextSharp, BUT first you should find out more about the document.
If the pdf contains an actual acroform form definition, filling it is fairly easy. There are many examples in the documentation and on the iText Web site.
If it does not contain such a form definition, though, and the check boxes and text fields merely are some lines drawn somewhere, it gets a bit more difficult: you have to measure where to put your entries.
Additionally you should find out whether the document is signed or encrypted which might limit what you are allowed to do with the document.

Printing documents contained in a sharepoint document library

I need a way to print selected documents in a library from the ribbon. As I understand it, this will have to be done through scripting. So the main difficulty seems to be the fact that everything will need to be done client-side. Another not so tiny factor is that it has be a generic document printing button, not just for pdf or office documents.
Is there any way to tell the OS/browser to launch for each of the selected items/documents its appropriate program's printing options/window?
Also I want this to be generic to document libraries so I can't just map one as a remote disc.
Another solution that springs to mind is to transfer the selected documents to another document library under the care of an event handler that runs the neccessary c# commands for printing when a new item is added to said(hidden) document library.
Another thing that comes to mind is to basically reiterate what most print drivers already do with the Print to file option where they create a pdf document of the intended material then it would be just a matter of printing the created pdf. But then the printing applications already know the file they have is in the correct/accepted format and merely have to make the convertion to pdf.
Is there any way to use the OS to just open/print-to-file my document with the correct application?
Any help with the script or c# part would be great. Thank you.

How to merge different document types and show as stack in .NET application

Suppose in .NET (don't care what language) I want to show a user a PDF, Word and Excel file together. I am trying to replicate a document process where a user might have a PDF file and he would like to attach a WORD file and an Excel file let's say to make a stack of documents (that I would save in some directory). Then he would like to click on a button and see a stack of these documents in 1 application of some sort.
How can I display the stack of documents WITHOUT first opening WORD, then openinig EXCEL and then openining ADOBE ACROBAT - this would be really annoying for the user. I would like one unified application or some idea to mimic one in .NET that can just show all 3 documents as if they were printed one after the other on paper. (I hope I am explaining this clearly)
The only thing I can think of to do this would be to leverage some sort of PDF conversion process to create one PDF file containing all three of these documents in "printed" (page-by-page) form, and then show that. The one application I can think of that could show all of these files is a web browser with appropriate Office and Acrobat viewer plugins, and you might find it difficult to leverage that, as browser preference and other user OS settings can cause various strategies for application launching to fail.
I would convert the documents in PDF and develop a pdf viewer inside your application.
I would use a ready made library for that, don't reinvent the wheel.
For example: http://www.quickpdflibrary.com/products/quickpdf/index.php

How to print data form C#

I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)

Categories

Resources