|
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Page with A5 size
PdfSection section1 = document.Sections.Add();
section1.PageSettings.Size = PdfPageSize.A5;
PdfPage page1 = section1.Pages.Add();
// Page with A3 size
PdfSection section2 = document.Sections.Add();
section2.PageSettings.Size = PdfPageSize.A3;
PdfPage page2 = section2.Pages.Add();
//Save the document.
document.Save(memoryStream);
document.Close(true); |
|
section.PageSettings.Size = new Syncfusion.Drawing.SizeF(image.Width, image.Height);
if (section.PageSettings.Size.Height < section.PageSettings.Size.Width)
{
section.PageSettings.Orientation = PdfPageOrientation.Landscape;
} |
|
PdfDocument document = new PdfDocument();
PdfBitmap img = new PdfBitmap(new MemoryStream(item.ImageData));
document.PageSettings.Margins.All = 0;
if (img.Width > img.Height)
{
document.PageSettings.Orientation = PdfPageOrientation.Landscape;
}
else
{
document.PageSettings.Orientation = PdfPageOrientation.Portrait;
}
PdfSection section = document.Sections.Add();
section.PageSettings.Size = new System.Drawing.SizeF(img.Width, img.Height);
PdfPage page = section.Pages.Add();
page.Graphics.DrawImage(img, new System.Drawing.PointF(), new System.Drawing.SizeF(img.Width, img.Height));
MemoryStream stream = new MemoryStream();
document.Save(stream);
document.Close(true); |