Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.PDF for .NET의 문서 객체 모델에 따르면, PDF 파일은 하나 이상의 페이지로 구성되어 있으며 각 페이지는 리소스 객체에 이미지, 양식 및 글꼴의 컬렉션을 포함합니다. 따라서 PDF 파일에서 이미지를 추출하기 위해 PDF 파일의 개별 페이지를 탐색하고 특정 페이지에서 이미지 컬렉션을 가져와 메모리 스트림 객체에 저장하여 Aspose.BarCodeRecognition의 BarCodeReader 클래스를 사용하여 추가 처리합니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void IdentifyBarcodes()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "IdentifyBarcodes.pdf"))
{
// Traverse through individual pages of PDF file
for (int pageCount = 1; pageCount <= document.Pages.Count; pageCount++)
{
// Traverse through each image extracted from PDF pages
foreach (var xImage in document.Pages[pageCount].Resources.Images)
{
using (var imageStream = new MemoryStream())
{
// Save PDF document image
xImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
// Set the stream position to the begining of Stream
imageStream.Position = 0;
// Instantiate BarCodeReader object
var barcodeReader = new Aspose.BarCodeRecognition.BarCodeReader(imageStream, Aspose.BarCodeRecognition.BarCodeReadType.Code39Extended);
while (barcodeReader.Read())
{
// Get BarCode text from BarCode image
var code = barcodeReader.GetCodeText();
// Write the BarCode text to Console output
Console.WriteLine("BARCODE : " + code);
}
// Close BarCodeReader object to release the Image file
barcodeReader.Close();
}
}
}
}
}
이 기사에서 다룬 주제에 대한 자세한 내용은 다음 링크를 방문하세요:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.