ByteScout PDF SDK - C# - Set String Scaling in PDF - ByteScout

ByteScout PDF SDK – C# – Set String Scaling in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Set String Scaling in PDF

How to set string scaling in PDF in C# using ByteScout PDF SDK

Tutorial on how to set string scaling in PDF in C#

With this source code sample you may quickly learn how to set string scaling in PDF in C#. ByteScout PDF SDK is the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms and you can use it to set string scaling in PDF with C#.

The SDK samples like this one below explain how to quickly make your application do set string scaling in PDF in C# with the help of ByteScout PDF SDK. In your C# project or application you may simply copy & paste the code and then run your app! Implementing C# application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Our website provides trial version of ByteScout PDF SDK for free. It also includes documentation and source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System.Diagnostics; using Bytescout.PDF; namespace StringScaling { /// <summary> /// This example demonstrates how to use the font scaling to expand a string. /// </summary> class Program { static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); Font font = new Font("Arial", 16); Brush brush = new SolidBrush(); StringFormat stringFormat = new StringFormat(); stringFormat.Scaling = 100f; page.Canvas.DrawString("Normal string 100.0%", font, brush, 20, 20, stringFormat); stringFormat.Scaling = 50.0f; page.Canvas.DrawString("Squeezed string 50.0%", font, brush, 20, 50, stringFormat); stringFormat.Scaling = 150.0f; page.Canvas.DrawString("Expanded string 150.0%", font, brush, 20, 80, stringFormat); // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next