Knowledgebase (2311)
Children categories
Spire.Doc supports to add new shape and shape group to the word document, it also supports to remove the shapes from the word. This article will show you how to reset the size of shape on an existing word document via Spire.Doc.
Firstly, view the original shape on the word document:

Step 1: Create a new instance of word document and load the document from file.
Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2010);
Step 2: Get the first section and the third paragraph that contains the shape.
Section section = doc.Sections[0]; Paragraph para = section.Paragraphs[2];
Step 3: Get the shape and reset the width and height for the shape.
ShapeObject shape = para.ChildObjects[0] as ShapeObject; shape.Width = 400; shape.Height = 300;
Step 4: Save the document to file.
doc.SaveToFile("result.docx",FileFormat.Docx2010);
Effective screenshot of the shape after reset the size.

Full codes:
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace Reset
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);
Section section = doc.Sections[0];
Paragraph para = section.Paragraphs[2];
ShapeObject shape = para.ChildObjects[0] as ShapeObject;
shape.Width = 400;
shape.Height = 300;
doc.SaveToFile("result.docx", FileFormat.Docx2010);
}
}
}
Imports Spire.Doc
Imports Spire.Doc.Documents
Imports Spire.Doc.Fields
Namespace Reset
Class Program
Private Shared Sub Main(args As String())
Dim doc As New Document()
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010)
Dim section As Section = doc.Sections(0)
Dim para As Paragraph = section.Paragraphs(2)
Dim shape As ShapeObject = TryCast(para.ChildObjects(0), ShapeObject)
shape.Width = 400
shape.Height = 300
doc.SaveToFile("result.docx", FileFormat.Docx2010)
End Sub
End Class
End Namespace
Print Multiple PDF Pages per Sheet and Print Single PDF Page to Multiple Sheets in C#
2017-10-24 08:04:36 Written by KoohjiWhen it comes to printing, Spire.PDF offers users a wide range of options to fulfil their printing needs. Two of these options are “print multiple PDF pages per sheet” and “print single PDF page to multiple sheets”. This article elaborates how to achieve these two options using Spire.PDF and C#.
Print Multiple PDF Pages per Sheet
Uses can invoke the SelectMultiPageLayout(int rows, int columns) method of the PdfPrintSettings class to print multiple PDF pages per sheet of paper.
using Spire.Pdf;
namespace PrintPDF
{
class Program
{
static void Main(string[] args)
{
//Initialize a PdfDocument object
PdfDocument pdf = new PdfDocument();
//Load the pdf file
pdf.LoadFromFile("Input.pdf");
//Print two PDF pages per sheet
pdf.PrintSettings.SelectMultiPageLayout(1, 2);
pdf.Print();
}
}
}
Below screenshot shows the sample pdf document which contains two pages:

Screenshot after printing to XPS:

Print Single PDF Page to Multiple Sheets
The SelectSplitPageLayout() method of the PdfPrintSettings class can be used when printing a large PDF page to multiple sheets. This method splits the PDF page to multiple pages according to the standard A4 paper size: 595pt*842pt.
using Spire.Pdf;
namespace PrintPDF2
{
class Program
{
static void Main(string[] args)
{
//Initialize a PdfDocument object
PdfDocument pdf = new PdfDocument();
//Load the pdf file
pdf.LoadFromFile("Input1.pdf");
//Print the PDF page to multiple sheets
pdf.PrintSettings.SelectSplitPageLayout();
pdf.Print();
}
}
}
Below screenshot shows the sample pdf document which contains a single page with a size of 2100pt*750pt:

Screenshot after printing to XPS:

Convert PDF to SVG with Custom Width and Height in C#, VB.NET
2017-10-24 07:04:26 Written by AdministratorWe've have demonstrated how to convert PDF page to SVG file format in the previous post. This guidance shows you how we can specify the width and height of output file using the latest version of Spire.PDF with C# and VB.NET.
Step 1: Load a sample PDF document to PdfDocument instance.
PdfDocument document = new PdfDocument();
document.LoadFromFile("pdf-sample.pdf");
Step 2: Specify the output file size through ConvertOptions.SetPdfToSvgOptions() method.
PdfToSvgConverter converter = new PdfToSvgConverter(inputFile);
converter.SvgOptions.ScaleX = (float)0.5;
converter.SvgOptions.ScaleY = (float)0.5;
converter.Convert(outputFile);
Step 3: Save PDF to SVG file format.
document.SaveToFile("result.svg", FileFormat.SVG);
Output:

Full Code:
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
PdfDocument document = new PdfDocument();
PdfToSvgConverter converter = new PdfToSvgConverter(inputFile);
converter.SvgOptions.ScaleX = (float)0.5;
converter.SvgOptions.ScaleY = (float)0.5;
converter.Convert(outputFile);
}
}
}
Imports Spire.Pdf
Imports Spire.Pdf.Conversion
Namespace ConvertPDFtoSVG
Class Program
Private Shared Sub Main(args As String())
Dim document As New PdfDocument()
document.LoadFromFile("pdf-sample.pdf")
' Specify the width And height of output SVG file
Dim Converter As New PdfToSvgConverter(inputFile)
Converter.SvgOptions.ScaleX = CSng(0.5)
Converter.SvgOptions.ScaleY = CSng(0.5)
Converter.Convert(outputFile)
document.SaveToFile("result.svg", FileFormat.SVG)
End Sub
End Class
End Namespace