Orientation not setting to Landscape.

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
Posts: 1
Joined: Mon Mar 08 2010

Orientation not setting to Landscape.

Post by lakshmanv »

Hello all,

I am using the .NET wrapper CDIntfNet300.dll. I am trying to get the PDF to print in Landscape orientation. That is not the case. Can you please help?

CDIntf.CDIntfControl PDF = new CDIntf.CDIntfControl();
PDF.PDFDriverInit("CEPP PDF Printer");
bool status = PDF.EnablePrinter(PdfPrinter.strCompany, PdfPrinter.strCode);
PDF.FileNameOptions = 1;
PDF.DefaultDirectory = "C:\\temp";
PDF.SetOrientation = 2;
TextPrintDocument doc = new TextPrintDocument(GetCharts(stocks));
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal

Re: Orientation not setting to Landscape.

Post by Devteam »

We see this question very frequently. The orientation setting in the PDF printer (or any other printer) is only the default setting for that printer. For e.g., when some applications start a new document, they would query the default printer setting and create a Portrait or Landscape document accordingly.But the actual setting is decided by the application that is printing, and not by the printer. If the application requests portrait, then no matter what the default printer setting is, it will print portrait.

In the example below, the portrait/landscape setting should be set at the TextPrintDocument level or its parent PrintDocument class. If this class relies on the default printer settings, then another problem might be that it is loading the printer settings before they are being changed to landscape through the code.

On another note, calling PDFDriverInit is not recommended and should be replaced by DriverInit. PDFDriverInit will attempt to install the printer which will fail unless the application is running with elevated privileges. The right way of doing this is to install the printer during the installation of the application and call DriverInit( PrinterName ).
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
Post Reply