Home > DeveloperSection > Forums > Force to print in legal paper
ezra heywood
ezra heywood

Total Post:145

Points:1019
Posted on    December-05-2014 2:58 AM

 ASP.Net C# 
Ratings:


 2 Reply(s)
 579  View(s)
Rate this:

I'm using iTextSharp to generate PDF documents in my asp.net application. That works great. The only issue I have is when I generate a PDF document with size of a legal paper and print it, the printer use the default paper which is letter size. I have to change the printing options manually in order to print it in legal paper. Is there a way I can specify in which paper size I want the document to print programmatically so that I won't have to do it manually?

 

I'm using this line of code to specify the page size in iTextSharp:

 

Document doc = new Document(PageSize.LEGAL.Rotate());



Kamlakar Singh
Kamlakar Singh

Total Post:28

Points:196
Posted on    December-05-2014 6:41 AM

You cannot control the client printer. That would be a huge security problem in the PDF format. It is up to that computer's settings.


Allen Scott

Total Post:41

Points:289
Posted on    December-05-2014 7:08 AM

The key is to set the viewer preference Choose paper source by PDF page size to true.

writer.AddViewerPreference(PdfName.PICKTRAYBYPDFSIZE, PdfBoolean.PDFTRUE);


Don't want to miss updates? Please click the below button!

Follow MindStick