Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
PDF 페이지를 다양한 이미지 형식으로 변환하려면 PdfConverter 객체를 생성하고 BindPdf 메서드를 사용하여 PDF 파일을 열어야 합니다. 그 후, 초기화 작업을 위해 DoConvert 메서드를 호출해야 합니다. 그런 다음 HasNextImage 및 GetNextImage 메서드를 사용하여 모든 페이지를 반복할 수 있습니다. GetNextImage 메서드는 특정 페이지의 이미지를 생성할 수 있게 해줍니다. 또한 이 메서드에 ImageFormat을 전달하여 특정 유형의 이미지(JPEG, GIF 또는 PNG 등)를 생성해야 합니다. 마지막으로 PdfConverter 클래스의 Close 메서드를 호출합니다. 다음 코드 스니펫은 PDF 페이지를 이미지로 변환하는 방법을 보여줍니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertPdfPagesToImages01()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfConverter object
using (var converter = new Aspose.Pdf.Facades.PdfConverter())
{
// Bind PDF document
converter.BindPdf(dataDir + "ConvertPdfPagesToImages.pdf");
// Initialize the converting process
converter.DoConvert();
// Check if pages exist and then convert to image one by one
while (converter.HasNextImage())
{
// Generate output file name with '_out' suffix
var outputFileName = dataDir + System.DateTime.Now.Ticks.ToString() + "_out.jpg";
// Convert the page to image and save it
converter.GetNextImage(outputFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
다음 코드 스니펫에서는 일부 매개변수를 변경하는 방법을 보여줍니다. CoordinateType로 ‘CropBox’ 프레임을 설정합니다. 또한 Resolution을 지정하여 인치당 점 수를 설정할 수 있습니다. 다음은 FormPresentationMode - 양식 프레젠테이션 모드입니다. 그런 다음 변환 시작 페이지 번호를 설정하는 StartPage를 지정합니다. 범위를 설정하여 마지막 페이지를 지정할 수도 있습니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertPdfPagesToImages02()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfConverter object
using (var converter = new Aspose.Pdf.Facades.PdfConverter())
{
// Bind PDF document
converter.BindPdf(dataDir + "ConvertPdfPagesToImages.pdf");
// Initialize the converting process
converter.DoConvert();
// Set additional conversion settings
converter.CoordinateType = Aspose.Pdf.PageCoordinateType.CropBox;
converter.Resolution = new Aspose.Pdf.Devices.Resolution(600);
converter.FormPresentationMode = Aspose.Pdf.Devices.FormPresentationMode.Production;
converter.StartPage = 2;
// Check if pages exist and then convert to image one by one
while (converter.HasNextImage())
{
// Generate output file name
var outputFileName = dataDir + System.DateTime.Now.Ticks.ToString() + "_out.jpg";
// Convert the page to image and save it
converter.GetNextImage(outputFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
다음 코드 스니펫에서는 PDF에서 이미지로 변환하는 과정에서 사용자 정의 글꼴 대체를 적용하는 방법을 보여줍니다. FontRepository.Substitutions 컬렉션을 사용하여 사용자 정의 대체 규칙을 등록합니다. 이 예제에서는 “Helvetica” 글꼴이 발견되면 “Arial"로 대체됩니다.
Aspose.PDF for .NET은 PDF 문서를 다양한 형식으로 변환할 수 있으며, 다른 형식에서 PDF로 변환할 수도 있습니다. 또한 Aspose.PDF 변환의 품질을 확인하고 Aspose.PDF 변환기 앱을 통해 결과를 온라인으로 볼 수 있습니다. 작업을 해결하기 위해 변환하기 섹션을 배우십시오.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.