Knowledgebase (2311)
Children categories
Spire.PDF supports to print a PDF in greyscale. This article is going to show you how to use Spire.PDF to accomplish this function.
Below is the example PDF file we used for demonstration:

Detail steps:
Step 1: Create a PdfDocument instance and load the PDF file.
PdfDocument pdf = new PdfDocument(); pdf.LoadFromFile(@"Stories.pdf");
Step 2: Set the PdfPrintSettings.Color property to false.
pdf.PrintSettings.Color = false;
Step 3: Print the document.
pdf.Print();
Screenshot after printing to xps:

Full code:
using Spire.Pdf;
namespace Print_PDF_in_Black_and_White
{
class Program
{
static void Main(string[] args)
{
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(@"Stories.pdf");
pdf.PrintSettings.Color = false;
pdf.Print();
}
}
}
Shadows make your shapes or pictures especially with transparent background pop out of your slide. They make flat 2 dimensional graphics look like 3 dimensional graphics. This article will show you how we can apply shadow effects to shapes and pictures in PowerPoint using Spire.Presentation.
Apply Shadow Effect to Shape
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace ApplyShadoweffect
{
class Program
{
static void Main(string[] args)
{
{
//Create a Presentation object and get the first slide.
Presentation ppt = new Presentation();
ISlide slide = ppt.Slides[0];
//Add a shape to slide.
RectangleF rect = new RectangleF(30, 80, 300, 120);
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, rect);
shape.Fill.FillType = FillFormatType.Solid;
shape.Fill.SolidColor.Color = Color.LightBlue;
shape.Line.FillType = FillFormatType.None;
shape.TextFrame.Text = "This demo shows how to apply shadow effect to shape.";
shape.TextFrame.TextRange.Fill.FillType = FillFormatType.Solid;
shape.TextFrame.TextRange.Fill.SolidColor.Color = Color.Black;
//Create an inner shadow effect through InnerShadowEffect object.
InnerShadowEffect innerShadow = new InnerShadowEffect();
innerShadow.BlurRadius = 20;
innerShadow.Direction = 0;
innerShadow.Distance = 0;
innerShadow.ColorFormat.Color = Color.Black;
//Apply the shadow effect to shape.
shape.EffectDag.InnerShadowEffect = innerShadow;
//Save to file.
ppt.SaveToFile("ShadowOnShape.pptx", FileFormat.Pptx2010);
}
}
}
}

Apply Shadow Effect to Picture
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace ApplyShadoweffect
{
class Program
{
static void Main(string[] args)
{
{
//Create a Presentation object and get the first slide.
Presentation ppt = new Presentation();
ISlide slide = ppt.Slides[0];
//Get the picture path.
string imagePath = "dinosaur.png";
Image image = Image.FromFile(imagePath);
float width = (float)image.Width / 3;
float height = (float)image.Height / 3;
//Add a shape to slide and fill the shape with picture.
RectangleF rect = new RectangleF(80, 80, width, height);
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, rect);
shape.Fill.FillType = FillFormatType.Picture;
shape.Fill.PictureFill.Picture.Url = imagePath;
shape.Fill.PictureFill.FillType = PictureFillType.Stretch;
shape.Line.FillType = FillFormatType.None;
//Choose a preset shadow effect.
PresetShadow presetShadow = new PresetShadow();
presetShadow.Preset = PresetShadowValue.BackLeftPerspective;
presetShadow.ColorFormat.Color = Color.LightGray;
//Apply the shadow effect to shape.
shape.EffectDag.PresetShadowEffect = presetShadow;
//Save to file.
ppt.SaveToFile("ShadowOnPicture.pptx", FileFormat.Pptx2010);
}
}
}
}

Convert the PDF to word, HTML, SVG, XPS and save them to stream
2018-03-13 08:11:24 Written by KoohjiThis article we will demonstrate how to convert the PDF pages to HTML, Word, SVG, XPS, PDF and save them to stream by calling the method PdfDocument.SaveToStream() offered by Spire.PDF. And starts from Spire.PDF version 4.3, it newly supports to convert the defined range of PDF pages and save them to stream.
Save the PDF to stream
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Save the document to stream.
MemoryStream ms=new MemoryStream (); pdf.SaveToStream(ms);
Save the PDF to stream and defined the file format to HTML, Word, SVG, XPS and PDF
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Save the document to stream and use FileFormat format to define the format.
MemoryStream ms=new MemoryStream (); pdf.SaveToStream(ms, FileFormat.HTML);
Convert the defined range of PDF pages to HTML, word, SVG, XPS and save them to stream
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Only save some PDF pages to stream by using pdf.SaveToStream(int startIndex, int endIndex, FileFormat format) method; and FileFormat.PDF is not supported.
pdf.SaveToStream(1, 2, FileFormat.SVG);
Full codes of save PDF to stream:
using Spire.Pdf;
using System.IO;
namespace SavePDFToStream
{
class Program
{
static void Main(string[] args)
{
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
MemoryStream ms = new MemoryStream();
pdf.SaveToStream(ms);
pdf.SaveToStream(ms, FileFormat.HTML);
pdf.SaveToStream(1, 2, FileFormat.SVG);
}
}
}