Convert to single page

Get technical support of PDF Focus .Net in C# and VB.Net
Garth Ogzy

Convert to single page

Post by Garth Ogzy »

Can PFDFocus convert only the first page (using RenderPages for instance) of a multi page PDF to a single page, but leave it in PDF format? Or, does it have to convert to a different format to extract just one page?
Oliver
Posts: 55
Joined: Wed Aug 19, 2020 11:59 am
Contact:

Re: Convert to single page

Post by Oliver »

Hello.

It's a very good question.

PDF Focus .Net - is a converter only. It can convert ALL Pages to ALL Pages.

But if you want to convert Multipage PDF in separate PDF files - the best way to use Document .Net
https://sautinsoft.com/products/document/

The code sample for you:
using System.IO;
using SautinSoft.Document;

namespace Example
{
class Program
{
static void Main(string[] args)
{
SplitDocumentByPages();
}

static void SplitDocumentByPages()
{
string filePath = @"..\..\example.pdf";
DocumentCore dc = DocumentCore.Load(filePath);
string folderPath = Path.GetFullPath(@"Result-files");
DocumentPaginator dp = dc.GetPaginator();
for (int i = 0; i < dp.Pages.Count; i++)
{
DocumentPage page = dp.Pages;
Directory.CreateDirectory(folderPath);

// Save the each page to PDF format.
page.Save(folderPath + @"\Page - " + i.ToString() + ".pdf", SaveOptions.PdfDefault);
}
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(folderPath) { UseShellExecute = true });
}
}
}

Thanks. Do you want to get another code samples: https://sautinsoft.com/products/document/help/net/


Last bumped by Anonymous on Tue Nov 08, 2022 11:29 am.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests