IronPrint를 사용한 C# 문서 인쇄 튜토리얼
IronPrint .NET C# 개발자가 애플리케이션에 인쇄 기능을 통합하는 데 도움을 주기 위해 설계된 강력한 인쇄 라이브러리입니다. IronPrint Windows, macOS, iOS 및 Android 플랫폼을 아우르는 폭넓은 호환성을 갖추고 있어 다양한 운영 체제에서 일관되고 안정적으로 작동합니다. 데스크톱 환경, Apple의 macOS 생태계 또는 iOS 및 Android와 같은 모바일 플랫폼용 애플리케이션을 개발하든 IronPrint 인쇄 기능 구현을 간소화하여 .NET C# 환경에서 모든 인쇄 요구 사항에 맞는 다재다능하고 사용자 친화적인 솔루션을 제공합니다.
빠른 시작: IronPrint 로 문서를 조용히 인쇄하기단 한 줄의 코드로 프린트 - 대화상자 없음, 번거로움 없음. 기본 또는 사용자 지정 설정을 사용하여 PDF 또는 이미지를 프린터로 직접 조용히 보내려면 IronPrint.Printer.Print(...)을 사용하세요.
-
1IronPrint를 NuGet Package Manager로 설치하십시오
-
2다음 코드 조각을 복사하여 실행하세요.
IronPrint.Printer.Print("path/to/your/document.pdf");IronPrint.Printer.Print("path/to/your/document.pdf")IronPrint.Printer.Print("path/to/your/document.pdf") -
3실제 운영 환경에서 테스트할 수 있도록 배포하세요.
오늘 프로젝트에서 IronPrint 사용을 시작해보세요 무료 체험
목차
- 문서 인쇄
- 인쇄 설정 적용
- 프린터 정보 가져오기
문서 인쇄
소리 없이 인쇄하기
인쇄 대화상자를 표시하지 않고 문서를 인쇄하세요. 인쇄 설정은 코드 내에서 직접 수행할 수 있습니다.
// Programmatically print a document without showing the print dialog.
// Define your print job and settings here as needed.
using System;
using IronPrint;
public class SilentPrint
{
public static void Main()
{
// Apply specific settings as necessary
// For example: set printer name, copies, etc.
var settings = new PrintSettings();
// Print the document without displaying the print dialog
Printer.Print("sample-document.pdf", settings);
}
}// Programmatically print a document without showing the print dialog.
// Define your print job and settings here as needed.
using System;
using IronPrint;
public class SilentPrint
{
public static void Main()
{
// Apply specific settings as necessary
// For example: set printer name, copies, etc.
var settings = new PrintSettings();
// Print the document without displaying the print dialog
Printer.Print("sample-document.pdf", settings);
}
}Imports System
Imports IronPrint
Public Class SilentPrint
Public Shared Sub Main()
' Apply specific settings as necessary
' For example: set printer name, copies, etc.
Dim settings = New PrintSettings()
' Print the document without displaying the print dialog
Printer.Print("sample-document.pdf", settings)
End Sub
End ClassImports System
Imports IronPrint
Public Class SilentPrint
Public Shared Sub Main()
' Apply specific settings as necessary
' For example: set printer name, copies, etc.
Dim settings = New PrintSettings()
' Print the document without displaying the print dialog
Printer.Print("sample-document.pdf", settings)
End Sub
End Class대화 상자를 사용하여 인쇄
인쇄 설정 대화 상자가 나타나면 인쇄 프로세스를 시작하십시오. 이를 통해 사용자는 인쇄 옵션을 대화형으로 맞춤 설정할 수 있습니다.
// Start a print job with user interaction through the print dialog.
using System;
using IronPrint;
public class DialogPrint
{
public static void Main()
{
var settings = new PrintSettings();
// Show the print dialog so the user can customize print options
Printer.ShowPrintDialog("sample-document.pdf", settings);
}
}// Start a print job with user interaction through the print dialog.
using System;
using IronPrint;
public class DialogPrint
{
public static void Main()
{
var settings = new PrintSettings();
// Show the print dialog so the user can customize print options
Printer.ShowPrintDialog("sample-document.pdf", settings);
}
}Imports System
Imports IronPrint
Public Class DialogPrint
Public Shared Sub Main()
Dim settings = New PrintSettings()
' Show the print dialog so the user can customize print options
Printer.ShowPrintDialog("sample-document.pdf", settings)
End Sub
End ClassImports System
Imports IronPrint
Public Class DialogPrint
Public Shared Sub Main()
Dim settings = New PrintSettings()
' Show the print dialog so the user can customize print options
Printer.ShowPrintDialog("sample-document.pdf", settings)
End Sub
End Class인쇄 설정 적용
특정 요구 사항을 충족하도록 인쇄 설정을 프로그램 방식으로 조정합니다. 이 섹션에서는 코드를 통해 인쇄 설정을 세밀하게 조정할 수 있는 기능을 제공합니다.
// Example code to apply custom print settings programmatically.
using System;
using IronPrint;
public class PrintSettingsExample
{
public static void Main()
{
// Set custom print settings such as grayscale and number of copies
var settings = new PrintSettings
{
Grayscale = false,
NumberOfCopies = 2
};
// Print the document using the configured settings
Printer.Print("sample-document.pdf", settings);
}
}// Example code to apply custom print settings programmatically.
using System;
using IronPrint;
public class PrintSettingsExample
{
public static void Main()
{
// Set custom print settings such as grayscale and number of copies
var settings = new PrintSettings
{
Grayscale = false,
NumberOfCopies = 2
};
// Print the document using the configured settings
Printer.Print("sample-document.pdf", settings);
}
}Imports System
Imports IronPrint
Public Class PrintSettingsExample
Public Shared Sub Main()
' Set custom print settings such as grayscale and number of copies
Dim settings = New PrintSettings With {
.Grayscale = False,
.NumberOfCopies = 2
}
' Print the document using the configured settings
Printer.Print("sample-document.pdf", settings)
End Sub
End ClassImports System
Imports IronPrint
Public Class PrintSettingsExample
Public Shared Sub Main()
' Set custom print settings such as grayscale and number of copies
Dim settings = New PrintSettings With {
.Grayscale = False,
.NumberOfCopies = 2
}
' Print the document using the configured settings
Printer.Print("sample-document.pdf", settings)
End Sub
End Class프린터 정보 가져오기
프린터 이름 가져오기
사용 가능한 모든 프린터 목록을 확인하세요. 시스템에 설치된 프린터 이름을 검색하여 정보 제공 또는 애플리케이션에서 동적으로 프린터를 선택하는 데 사용할 수 있습니다.
// Retrieve and display a list of printer names available on the system.
using System;
using IronPrint;
public class PrinterInfo
{
public static void Main()
{
// Get an enumerable list of printer names
var printerNames = Printer.GetPrinterNames();
// Print each printer name to the console
Console.WriteLine("Available Printers:");
foreach (var name in printerNames)
{
Console.WriteLine(name);
}
}
}// Retrieve and display a list of printer names available on the system.
using System;
using IronPrint;
public class PrinterInfo
{
public static void Main()
{
// Get an enumerable list of printer names
var printerNames = Printer.GetPrinterNames();
// Print each printer name to the console
Console.WriteLine("Available Printers:");
foreach (var name in printerNames)
{
Console.WriteLine(name);
}
}
}Imports System
Imports IronPrint
Public Class PrinterInfo
Public Shared Sub Main()
' Get an enumerable list of printer names
Dim printerNames = Printer.GetPrinterNames()
' Print each printer name to the console
Console.WriteLine("Available Printers:")
For Each name In printerNames
Console.WriteLine(name)
Next
End Sub
End ClassImports System
Imports IronPrint
Public Class PrinterInfo
Public Shared Sub Main()
' Get an enumerable list of printer names
Dim printerNames = Printer.GetPrinterNames()
' Print each printer name to the console
Console.WriteLine("Available Printers:")
For Each name In printerNames
Console.WriteLine(name)
Next
End Sub
End Class자주 묻는 질문
IronPrint는 어떤 플랫폼에서 문서 인쇄를 지원하나요?
IronPrint는 Windows, macOS, iOS 및 Android를 포함한 다양한 플랫폼에서 인쇄를 지원하여 다양한 운영 체제에서의 직관적인 통합을 보장합니다.
IronPrint를 사용하여 인쇄 대화 상자를 표시하지 않고 문서를 인쇄하려면 어떻게 해야 하나요?
IronPrint를 사용하면 IronPrint.Printer.Print("path/to/your/document.pdf"); 단 한 줄의 코드로 조용히 문서를 인쇄할 수 있습니다. 이를 통해 대화 상자 방해 없이 직접 PDF를 프린터로 보낼 수 있습니다.
IronPrint를 사용하여 프로그래밍 방식으로 인쇄 설정을 사용자 정의할 수 있습니까?
네, IronPrint를 사용하면 C# 애플리케이션 코드 내에서 프린터 이름, 복사본 수 등과 같은 설정을 정의하여 프로그래밍 방식으로 인쇄 설정을 사용자 정의할 수 있습니다.
IronPrint를 사용하여 대화형으로 인쇄 옵션을 설정할 수 있습니까?
IronPrint는 사용자가 인쇄 대화 상자를 이용하여 다양한 인쇄 설정을 사용자 선호에 따라 맞춤화하면서 인쇄 작업을 시작할 수 있게 합니다.
IronPrint를 사용하여 사용 가능한 프린터 이름을 어떻게 가져오나요?
IronPrint의 Printer.GetPrinterNames() 메서드를 구현하여 시스템에 설치된 프린터 이름 목록을 나열할 수 있습니다.
IronPrint가 처리할 수 있는 문서 유형은 무엇인가요?
IronPrint는 PDF, PNG, HTML, TIFF, GIF, JPEG 등 여러 문서 유형을 처리할 수 있어 다양한 인쇄 요구에 맞는 다재다능한 도구입니다.
IronPrint는 데스크톱 및 모바일 애플리케이션과 모두 호환됩니까?
네, IronPrint는 데스크톱 환경(Windows 및 macOS)과 모바일 플랫폼(iOS 및 Android) 모두와 호환되어 다양한 장치 간 유연한 인쇄 솔루션을 제공합니다.
IronPrint는 그레이스케일 인쇄를 수행하고 프로그래밍 방식으로 복사본 수를 조정할 수 있습니까?
네, IronPrint의 PrintSettings 클래스를 사용하여 C# 코드 내에서 그레이스케일을 활성화하거나 복사본 수를 지정하는 등 사용자 정의 인쇄 설정을 직접 설정할 수 있습니다.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.