I'm just testing Spire.PDF with the Free Version 4.3.1 and I am not able to print a PDF in landscape format. I have used different printers and settings. Is there a limitation in the free version?
- Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageSettings ps = new PdfPageSettings();
ps.Margins.Top = 20;
ps.Margins.Bottom = 20;
ps.Margins.Left = 20;
ps.Margins.Right = 20;
ps.Size = PdfPageSize.A4;
PdfPageBase page = doc.Pages.Add(ps.Size, ps.Margins, 0, PdfPageOrientation.Landscape );
PdfBrush brush = new PdfSolidBrush(Color.Black);
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 18f, FontStyle.Bold));
PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Left);
format.CharacterSpacing = 1f;
String text = "test test test";
page.Canvas.DrawString(text, font, brush, 100, 100, format);
doc.PrintDocument.PrinterSettings.DefaultPageSettings.Landscape = true;
doc.PageScaling = PdfPrintPageScaling.FitSize;
doc.PrintDocument.Print();
doc.SaveToFile("test.pdf");
doc.Close();
Process.Start("test.pdf");
But i'm able to print the test.pdf without any problems with Adobe Acrobat!