Como migrar do PDFFilePrint para o IronPDF em C#
Migrar do Arquivo PDFImprimir para o IronPDF move seu fluxo de trabalho PDF .NET de um envoltório Pdfium focado em impressão para uma biblioteca PDF abrangente que lida com criação, manipulação e impressão em uma única API unificada. Este guia fornece um caminho de migração passo a passo que substitui as configurações de impressão controladas por app.config com PrinterSettings fortemente tipadas, enquanto adiciona capacidades de geração e manipulação de PDF que o Arquivo PDFImprimir não fornece.
Por que migrar do Arquivo PDFImprimir para o IronPDF?
Entendendo o PDFFilePrint
PDFFilePrint é um pequeno pacote NuGet de código aberto (MIT, por Christian Andersen) que envolve PdfiumViewer e o Pdfium da Google para enviar silenciosamente um arquivo PDF ou XPS existente para um driver de impressora. A última versão é 1.0.3, publicada em 2020-02-10, visando .NET Framework 4.6.1+ no Windows. Embora útil para tarefas de impressão direcionadas, sua funcionalidade é limitada a um aspecto do manuseio do documento — a superfície pública é essencialmente new FilePrint(path, null).Print() impulsionada por chaves app.config / Properties.Settings.Default.
Limitações críticas do PDFFilePrint
-
Apenas Impressão: Não pode criar, editar, mesclar ou modificar PDFs — a classe
FilePrintconsome arquivos PDF/XPS existentes e os entrega ao spooler. -
API Dirigida por Arquivo de Configuração: Nome da impressora, tamanho do papel, contagem de cópias e modo 'imprimir em arquivo' são lidos de
app.config(Properties.Settings.Default), não passados como um objeto de opções fortemente tipadas. -
Somente Windows + .NET Framework: Destina-se a
net461e puxa binários nativos Win32 do PdfiumViewer. Nenhum .NET Core / .NET 6+ TFM, e nenhum suporte para Linux/macOS. -
Botões de Impressão Limitados: Duplex, intervalo de páginas, orientação e cor dependem do padrão do driver da impressora — não há API de primeira classe para eles.
-
Efetivamente Sem Manutenção: Nenhuma versão desde 1.0.3 (Fevereiro de 2020) e nenhum repositório público de origem vinculado à lista do NuGet.
-
Superfície de Exceção Simples: Falhas surgem do PdfiumViewer / do spooler como exceções genéricas em vez de uma hierarquia de erros tipada.
- Sem Geração de PDF: Não pode criar PDFs — para ir de HTML, URL ou imagens para uma página impressa, você deve emparelhar o Arquivo PDFImprimir com um renderizador separado.
Comparação entre Arquivo PDFImprimir e IronPDF
| Aspecto | Arquivo PDFImprimir | IronPDF |
|---|---|---|
| Foco principal | Impressão PDF/XPS | API de PDF abrangente |
| Tipo | Envoltório de impressão Pdfium | Biblioteca nativa .NET + renderizador Chromium |
| Integração | new FilePrint(...).Print() + app.config |
API PdfDocument Direta |
| Impressão em PDF | Sim | Sim |
| Criação de PDF | Não | Sim (HTML, URL, imagens) |
| Manipulação de PDF | Não | Sim (mesclar, dividir, editar) |
| Multiplataforma | Somente Windows (net461) | Windows, Linux, macOS, Docker |
| Tratamento de erros | Exceções simples do PdfiumViewer | IronPdfException Tipado |
| IntelliSense | Mínimo (superfície pequena) | Completo |
| Pacote NuGet | PDFFilePrint 1.0.3 (MIT, Fev 2020) |
IronPdf |
| Última versão | 1.0.3 (Fevereiro de 2020) | Lançamentos ativos |
Para equipes que visam o .NET moderno (Framework 4.6.2+ e .NET 6/7/8/9/10),IronPDF oferece uma base abrangente com suporte multiplataforma e desenvolvimento ativo, abordando as limitações arquitetônicas do PDFFilePrint.
Antes de começar
Pré-requisitos
- Ambiente .NET: .NET Framework 4.6.2+ ou .NET 6/7/8/9/10
- Acesso ao NuGet : Capacidade de instalar pacotes NuGet.
- Licença do IronPDF: Obtenha sua chave de licença em IronPDF
Alterações no pacote NuGet
# Remove Arquivo PDFImprimir package
dotnet remove package PDFFilePrint
# Install IronPDF
dotnet add package IronPdf
# Remove Arquivo PDFImprimir package
dotnet remove package PDFFilePrint
# Install IronPDF
dotnet add package IronPdf
Configuração de licença
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Startup.vb)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Identificar o uso do PDFFilePrint
# Find Arquivo PDFImprimir API usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
# Find Arquivo PDFImprimir API usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
Referência completa da API
Alterações de namespace
// PDFFilePrint
using PDFFilePrint;
//IronPDF— printing flows through System.Drawing.Printing
using IronPdf;
using System.Drawing.Printing;
// PDFFilePrint
using PDFFilePrint;
//IronPDF— printing flows through System.Drawing.Printing
using IronPdf;
using System.Drawing.Printing;
Imports PDFFilePrint
Imports IronPdf
Imports System.Drawing.Printing
Mapeamentos de Classes Principais
| Arquivo PDFImprimir | IronPDF |
|---|---|
new FilePrint(path, null) (carregar) |
PdfDocument.FromFile(path) |
new ChromePdfRenderer() (sem equivalente — Arquivo PDFImprimir não pode criar PDFs) |
new ChromePdfRenderer() |
FilePrint |
PdfDocument |
Mapeamentos de métodos de geração de PDF
| Arquivo PDFImprimir | IronPDF |
|---|---|
| (não disponível) | renderer.RenderHtmlAsPdf(html) |
| (não disponível) | renderer.RenderUrlAsPdf(url) |
| (não disponível — apenas impressão) | pdf.SaveAs(path) |
Carregamento e impressão de mapas em PDF
| Arquivo PDFImprimir | IronPDF |
|---|---|
new FilePrint(path, null) |
PdfDocument.FromFile(path) |
fileprint.Print() (silencioso, sempre) |
pdf.Print() (silencioso) / pdf.Print(true) (diálogo) |
Properties.Settings.Default.PrinterName = "..." então Print() |
pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print() |
Mapeamento de Configurações de Impressão (app.config para PrinterSettings)
Configuração do Arquivo PDFImprimir (Settings.Default) |
IronPDF(System.Drawing.Printing.PrinterSettings) |
|---|---|
PrinterName |
PrinterName |
Copies |
Copies |
| (sem sinalizador silencioso — sempre silencioso) | pdf.Print() (silencioso) / pdf.Print(true) (mostrar diálogo) |
| (padrão do driver) | FromPage, ToPage, PrintRange |
| (padrão do driver) | DefaultPageSettings.Landscape |
| (padrão do driver) | Duplex |
| (padrão do driver) | Collate |
PaperName |
DefaultPageSettings.PaperSize |
PrintToFile + DefaultPrintToDirectory |
PrintToFile + PrintFileName |
Novas funcionalidades não presentes no PDFFilePrint
| Recurso IronPDF | Descrição |
|---|---|
PdfDocument.Merge() |
Combinar vários PDFs |
pdf.CopyPages() |
Extrair páginas específicas |
pdf.ApplyWatermark() |
Adicionar marcas d'água |
pdf.SecuritySettings |
Proteção por senha |
pdf.ExtractAllText() |
Extrair conteúdo de texto |
pdf.RasterizeToImageFiles() |
Converter em imagens |
pdf.SignWithDigitalSignature() |
Assinaturas digitais |
Exemplos de migração de código
Exemplo 1: Conversão de HTML para PDF
Antes (PDFFilePrint):
// NuGet: Install-Package PDFFilePrint
// Arquivo PDFImprimir is a print-only wrapper around PdfiumViewer / Pdfium.
// Its FilePrint class only consumes existing PDF/XPS files — there is
// no CreateFromHtml or document-creation method.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " +
"with another library, then pass the path to new FilePrint(path, null).Print().");
}
}
// NuGet: Install-Package PDFFilePrint
// Arquivo PDFImprimir is a print-only wrapper around PdfiumViewer / Pdfium.
// Its FilePrint class only consumes existing PDF/XPS files — there is
// no CreateFromHtml or document-creation method.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " +
"with another library, then pass the path to new FilePrint(path, null).Print().");
}
}
Imports System
Class Program
Shared Sub Main()
Throw New NotSupportedException("PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " &
"with another library, then pass the path to new FilePrint(path, null).Print().")
End Sub
End Class
Após (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim htmlContent As String = "<html><body><h1>Hello World</h1></body></html>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
End Sub
End Class
A diferença fundamental aqui é o escopo. Arquivo PDFImprimir não tem caminho de HTML para PDF — sua superfície pública é uma classe FilePrint que entrega um PDF existente à impressora.IronPDF separa o renderização do objeto do documento: ChromePdfRenderer lida com a conversão de HTML para PDF e retorna um PdfDocument que você então salva com SaveAs().
Esta separação também permite que você configure opções de renderização no renderizador antes da conversão, e manipule o PdfDocument retornado (adicione marcas d'água, mescle com outros PDFs, adicione segurança) antes de salvar. Consulte a documentação de conversão de HTML para PDF para obter opções de renderização adicionais.
Exemplo 2: Conversão de URL para PDF
Antes (PDFFilePrint):
// NuGet: Install-Package PDFFilePrint
// Arquivo PDFImprimir cannot fetch a URL or render HTML — it only sends existing
// PDF/XPS files to a printer. URL-to-PDF requires a separate renderer.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " +
"another library first, then call new FilePrint(pdfPath, null).Print().");
}
}
// NuGet: Install-Package PDFFilePrint
// Arquivo PDFImprimir cannot fetch a URL or render HTML — it only sends existing
// PDF/XPS files to a printer. URL-to-PDF requires a separate renderer.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " +
"another library first, then call new FilePrint(pdfPath, null).Print().");
}
}
Imports System
Class Program
Shared Sub Main()
Throw New NotSupportedException("PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " & _
"another library first, then call new FilePrint(pdfPath, null).Print().")
End Sub
End Class
Após (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
pdf.SaveAs("webpage.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
pdf.SaveAs("webpage.pdf");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
pdf.SaveAs("webpage.pdf")
End Sub
End Class
PDFFilePrint não tem capacidade de obtenção de URL.IronPDF usa o método dedicado RenderUrlAsPdf() em ChromePdfRenderer, que aproveita um motor Chromium para renderizar CSS moderno, JavaScript e recursos da web. Saiba mais sobre a conversão de URL para PDF .
Exemplo 3: Impressão em PDF
Antes (PDFFilePrint):
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;
class Program
{
static void Main()
{
// Optional: override the configured printer / copy count at runtime.
Properties.Settings.Default.PrinterName = "Default Printer";
var fileprint = new FilePrint("document.pdf", null);
fileprint.Print();
Console.WriteLine("PDF sent to printer");
}
}
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;
class Program
{
static void Main()
{
// Optional: override the configured printer / copy count at runtime.
Properties.Settings.Default.PrinterName = "Default Printer";
var fileprint = new FilePrint("document.pdf", null);
fileprint.Print();
Console.WriteLine("PDF sent to printer");
}
}
Imports System
Imports PDFFilePrint
Module Program
Sub Main()
' Optional: override the configured printer / copy count at runtime.
Properties.Settings.[Default].PrinterName = "Default Printer"
Dim fileprint = New FilePrint("document.pdf", Nothing)
fileprint.Print()
Console.WriteLine("PDF sent to printer")
End Sub
End Module
Após (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Drawing.Printing;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
// Silent print to the default printer
pdf.Print();
// Or print to a named printer with explicit PrinterSettings:
// var settings = new PrinterSettings { PrinterName = "HP LaserJet Pro" };
// pdf.GetPrintDocument(settings).Print();
Console.WriteLine("PDF sent to printer");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Drawing.Printing;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
// Silent print to the default printer
pdf.Print();
// Or print to a named printer with explicit PrinterSettings:
// var settings = new PrinterSettings { PrinterName = "HP LaserJet Pro" };
// pdf.GetPrintDocument(settings).Print();
Console.WriteLine("PDF sent to printer");
}
}
Imports IronPdf
Imports System
Imports System.Drawing.Printing
Module Program
Sub Main()
Dim pdf = PdfDocument.FromFile("document.pdf")
' Silent print to the default printer
pdf.Print()
' Or print to a named printer with explicit PrinterSettings:
' Dim settings As New PrinterSettings With {.PrinterName = "HP LaserJet Pro"}
' pdf.GetPrintDocument(settings).Print()
Console.WriteLine("PDF sent to printer")
End Sub
End Module
Este exemplo mostra a diferença arquitetônica entre as duas bibliotecas. Arquivo PDFImprimir instantiates new FilePrint(path, null) e chama Print(), com o nome da impressora e contagem de cópias lidos de app.config (Properties.Settings.Default).IronPDF utiliza a fábrica estática PdfDocument.FromFile() para carregar, em seguida, Print() que utiliza a impressora padrão — ou você passa um System.Drawing.Printing.PrinterSettings através de GetPrintDocument(settings).Print() para controle explícito.
As principais alterações de migração:
new FilePrint(path, null)→PdfDocument.FromFile(path)Properties.Settings.Default.PrinterName = "..."+Print()→pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print()- Impressora padrão: deixe
PrinterNamevazio emSettings.Default→ chamepdf.Print()
Para configurações avançadas de impressão, o IronPDF utiliza System.Drawing.Printing.PrinterSettings. Veja a documentação de impressão para opções adicionais.
Migração de configurações avançadas de impressão
Para aplicações que usam as chaves app.config do PDFFilePrint, veja como migrar para o PrinterSettings fortemente tipado do IronPDF:
// Arquivo PDFImprimir approach — settings live in app.config and are read via
// Properties.Settings.Default. To override at runtime you mutate Settings.Default
// before instantiating FilePrint:
// Properties.Settings.Default.PrinterName = "HP LaserJet";
// Properties.Settings.Default.Copies = 3;
// new FilePrint("document.pdf", null).Print();
//
//IronPDF equivalent — pass a System.Drawing.Printing.PrinterSettings per call:
using IronPdf;
using System.Drawing.Printing;
var pdf = PdfDocument.FromFile("document.pdf");
var settings = new PrinterSettings
{
PrinterName = "HP LaserJet",
Copies = 3,
FromPage = 1,
ToPage = 5,
PrintRange = PrintRange.SomePages
};
pdf.GetPrintDocument(settings).Print();
// Arquivo PDFImprimir approach — settings live in app.config and are read via
// Properties.Settings.Default. To override at runtime you mutate Settings.Default
// before instantiating FilePrint:
// Properties.Settings.Default.PrinterName = "HP LaserJet";
// Properties.Settings.Default.Copies = 3;
// new FilePrint("document.pdf", null).Print();
//
//IronPDF equivalent — pass a System.Drawing.Printing.PrinterSettings per call:
using IronPdf;
using System.Drawing.Printing;
var pdf = PdfDocument.FromFile("document.pdf");
var settings = new PrinterSettings
{
PrinterName = "HP LaserJet",
Copies = 3,
FromPage = 1,
ToPage = 5,
PrintRange = PrintRange.SomePages
};
pdf.GetPrintDocument(settings).Print();
Imports IronPdf
Imports System.Drawing.Printing
Dim pdf = PdfDocument.FromFile("document.pdf")
Dim settings As New PrinterSettings With {
.PrinterName = "HP LaserJet",
.Copies = 3,
.FromPage = 1,
.ToPage = 5,
.PrintRange = PrintRange.SomePages
}
pdf.GetPrintDocument(settings).Print()
Modo Silencioso
// Arquivo PDFImprimir is always silent — there is no print-dialog code path.
//IronPDF is silent by default. Pass true explicitly to show the print dialog:
pdf.Print(); // silent
pdf.Print(true); // shows print dialog
// Arquivo PDFImprimir is always silent — there is no print-dialog code path.
//IronPDF is silent by default. Pass true explicitly to show the print dialog:
pdf.Print(); // silent
pdf.Print(true); // shows print dialog
' Arquivo PDFImprimir is always silent — there is no print-dialog code path.
' IronPDF is silent by default. Pass True explicitly to show the print dialog:
pdf.Print() ' silent
pdf.Print(True) ' shows print dialog
Novas funcionalidades após a migração
Após migrar para o IronPDF, você obtém recursos que o Arquivo PDFImprimir não pode fornecer:
Crie e imprima em uma única etapa
using IronPdf;
using System.Drawing.Printing;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
var settings = new PrinterSettings { PrinterName = "Office Printer" };
pdf.GetPrintDocument(settings).Print();
using IronPdf;
using System.Drawing.Printing;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
var settings = new PrinterSettings { PrinterName = "Office Printer" };
pdf.GetPrintDocument(settings).Print();
Imports IronPdf
Imports System.Drawing.Printing
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>")
Dim settings As New PrinterSettings With {.PrinterName = "Office Printer"}
pdf.GetPrintDocument(settings).Print()
Fusão de PDFs
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
Dim pdf1 = PdfDocument.FromFile("document1.pdf")
Dim pdf2 = PdfDocument.FromFile("document2.pdf")
Dim merged = PdfDocument.Merge(pdf1, pdf2)
merged.SaveAs("merged.pdf")
Marcas d'água
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
Dim pdf = PdfDocument.FromFile("document.pdf")
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>")
pdf.SaveAs("watermarked.pdf")
Proteção por senha
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SecuritySettings.UserPassword = "userpassword"
pdf.SecuritySettings.OwnerPassword = "ownerpassword"
pdf.SaveAs("secured.pdf")
Extração de texto
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
Dim pdf = PdfDocument.FromFile("document.pdf")
Dim text As String = pdf.ExtractAllText()
Notas críticas sobre migração
Mudança no padrão de classe
O Arquivo PDFImprimir usa uma pequena classe FilePrint com um único método Print(), impulsionada por app.config.IronPDF separa renderização, manipulação de documentos e impressão em tipos distintos:
// PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet";
var fileprint = new FilePrint(path, null);
fileprint.Print();
// IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
var pdf = PdfDocument.FromFile(path);
var settings = new PrinterSettings { PrinterName = "HP LaserJet" };
pdf.GetPrintDocument(settings).Print();
//IronPDF can also create PDFs from HTML — Arquivo PDFImprimir cannot
var renderer = new ChromePdfRenderer();
var newPdf = renderer.RenderHtmlAsPdf(html);
newPdf.SaveAs(path);
// PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet";
var fileprint = new FilePrint(path, null);
fileprint.Print();
// IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
var pdf = PdfDocument.FromFile(path);
var settings = new PrinterSettings { PrinterName = "HP LaserJet" };
pdf.GetPrintDocument(settings).Print();
//IronPDF can also create PDFs from HTML — Arquivo PDFImprimir cannot
var renderer = new ChromePdfRenderer();
var newPdf = renderer.RenderHtmlAsPdf(html);
newPdf.SaveAs(path);
' PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet"
Dim fileprint = New FilePrint(path, Nothing)
fileprint.Print()
' IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
Dim pdf = PdfDocument.FromFile(path)
Dim settings = New PrinterSettings With {.PrinterName = "HP LaserJet"}
pdf.GetPrintDocument(settings).Print()
' IronPDF can also create PDFs from HTML — Arquivo PDFImprimir cannot
Dim renderer = New ChromePdfRenderer()
Dim newPdf = renderer.RenderHtmlAsPdf(html)
newPdf.SaveAs(path)
Mudanças de Nomeação de Método / Configuração
// Arquivo PDFImprimir → IronPDF
new FilePrint(path, null) → PdfDocument.FromFile(path)
fileprint.Print() → pdf.Print() // silent default
Properties.Settings.Default.PrinterName = "X" → new PrinterSettings { PrinterName = "X" }
Properties.Settings.Default.Copies = 3 → new PrinterSettings { Copies = 3 }
Properties.Settings.Default.PaperName = "A4" → settings.DefaultPageSettings.PaperSize = ...
// Arquivo PDFImprimir has no native HTML/URL/merge/watermark methods — these are IronPDF-only.
// Arquivo PDFImprimir → IronPDF
new FilePrint(path, null) → PdfDocument.FromFile(path)
fileprint.Print() → pdf.Print() // silent default
Properties.Settings.Default.PrinterName = "X" → new PrinterSettings { PrinterName = "X" }
Properties.Settings.Default.Copies = 3 → new PrinterSettings { Copies = 3 }
Properties.Settings.Default.PaperName = "A4" → settings.DefaultPageSettings.PaperSize = ...
// Arquivo PDFImprimir has no native HTML/URL/merge/watermark methods — these are IronPDF-only.
Tratamento de Exceções
// PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
try {
new FilePrint(path, null).Print();
}
catch (Exception ex) {
// Não granular error type — log the message and inner exception.
}
// IronPDF: typed exception hierarchy
try {
pdf.Print();
}
catch (IronPdf.Exceptions.IronPdfException ex) {
// Granular error details
}
// PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
try {
new FilePrint(path, null).Print();
}
catch (Exception ex) {
// Não granular error type — log the message and inner exception.
}
// IronPDF: typed exception hierarchy
try {
pdf.Print();
}
catch (IronPdf.Exceptions.IronPdfException ex) {
// Granular error details
}
Imports IronPdf.Exceptions
' PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
Try
Dim filePrint As New FilePrint(path, Nothing)
filePrint.Print()
Catch ex As Exception
' Não granular error type — log the message and inner exception.
End Try
' IronPDF: typed exception hierarchy
Try
pdf.Print()
Catch ex As IronPdfException
' Granular error details
End Try
Nenhum Executável Externo de Qualquer Forma
Ambas as bibliotecas são distribuídas como pacotes NuGet. Não há PDFFilePrint.exe para incluir ou remover — dotnet remove package PDFFilePrint é suficiente do lado do PDFFilePrint.IronPDF é igualmente autossuficiente através do pacote IronPdf, com dependências nativas resolvidas na hora do restauro.
Resumo da comparação de recursos
| Recurso | Arquivo PDFImprimir | IronPDF |
|---|---|---|
| Impressão básica | ✓ | ✓ |
| Impressão silenciosa | ✓ (sempre silencioso) | ✓ |
| Várias cópias | ✓ (via app.config) | ✓ |
| Intervalo de páginas | Somente padrão do driver | ✓ |
| Duplex | Somente padrão do driver | ✓ |
| Criar a partir de HTML | ✗ | ✓ |
| Criar a partir de um URL | ✗ | ✓ |
| Mesclar PDFs | ✗ | ✓ |
| Dividir PDFs | ✗ | ✓ |
| Adicionar marcas d'água | ✗ | ✓ |
| Extrair texto | ✗ | ✓ |
| Proteção por senha | ✗ | ✓ |
| Assinaturas digitais | ✗ | ✓ |
| Multiplataforma | ✗ (Windows / net461) | ✓ |
| API nativa do .NET | ✓ (superfície pequena) | ✓ |
Lista de verificação para migração
Pré-migração
- Localizar todos os locais de chamada
using PDFFilePrint;enew FilePrint(...) - Documentar configurações atuais de
app.config(PrinterName,PaperName,Copies,PrintToFile,DefaultPrintToDirectory) - Identificar os nomes das impressoras utilizadas em diferentes ambientes.
- Note qualquer código que mude
Properties.Settings.Defaultem tempo de execução - Identifique oportunidades para novos recursos (renderização HTML/URL, mesclagem, marcas d'água, segurança)
- Obtenha a chave de licença do IronPDF
Alterações no pacote
- Remover o pacote NuGet
PDFFilePrint:dotnet remove package PDFFilePrint - Instalar o pacote NuGet
IronPdf:dotnet add package IronPdf - Substituir
using PDFFilePrint;porusing IronPdf;(adicionarusing System.Drawing.Printing;onde necessário)
Alterações no código
- Adicionar configuração de chave de licença na inicialização
- Substituir
new FilePrint(path, null)porPdfDocument.FromFile(path) - Mover as configurações de impressora/cópia/papel de
app.confige paraSystem.Drawing.Printing.PrinterSettings - Use
pdf.Print()para saída padrão da impressora silenciosa, oupdf.GetPrintDocument(settings).Print()para opções explícitas - Envolva chamadas
Print()emtry/catch IronPdfExceptiononde você pegava exceções genéricas anteriormente - Para recursos de HTML/URL/mesclagem/marca d'água (que o Arquivo PDFImprimir nunca ofereceu), use
ChromePdfRenderere a API de manipulaçãoPdfDocument
Pós-migração
- Remova as chaves específicas do Arquivo PDFImprimir de
app.config - Teste a impressão em todas as impressoras de destino.
- Teste multiplataforma, se aplicável (a impressão Linux requer CUPS)
- Adicione novos recursos (marcas d'água, segurança, mesclagem) conforme necessário
- Atualizar documentação
({i:PDFFilePrint é uma marca registrada de seu respectivo proprietário. Este site não é afiliado, endossado por, ou patrocinado pela PDFFilePrint. Todos os nomes de produtos, logotipos e marcas são propriedade de seus respectivos proprietários. As comparações são apenas para fins informativos e refletem informações disponíveis publicamente no momento da redação.

