PDFFilePrint'ten IronPDF'e C# ile Nasıl Geçilir
PDFFilePrint'ten IronPDF'ye geçiş yapmak, .NET PDF iş akışınızı yalnızca baskı odaklı bir Pdfium sarmalayıcıdan, oluşturma, manipülasyon ve baskıyı tek bir birleşik API içinde yöneten kapsamlı bir PDF kütüphanesine taşır. Bu kılavuz, PDFFilePrint'in sağlamadığı PDF oluşturma ve düzenleme yeteneklerini eklerken, app.config odaklı baskı ayarlarını, güçlü şekilde türlendirilmiş PrinterSettings ile değiştiren adım adım bir geçiş yolu sağlar.
PDFFilePrint'ten IronPDF'e Neden Geçmeli
PDFFilePrint'i Anlamak
PDFFilePrint, PdfiumViewer ve Google'ın Pdfium'unu sararak mevcut bir PDF veya XPS dosyasını yazıcı sürücüsüne sessizce gönderen küçük ve açık kaynaklı bir NuGet paketidir (Christian Andersen tarafından MIT lisansı ile). Son sürüm 1.0.3, 2020-02-10 tarihlerinde yayınlandı ve Windows üzerinde .NET Framework 4.6.1+ üzerine odaklanıyor. Hedeflenmiş baskı görevleri için faydalı olmakla birlikte, işlevselliği belge işlemenin bir yönüyle sınırlıdır — genel yüzey, esasen new FilePrint(path, null).Print() / app.config / Properties.Settings.Default anahtarları tarafından yönlendirilir.
KritikPDFFilePrintSınırlamaları
-
Sadece Baskı: PDF oluşturamaz, düzenleyemez, birleştiremez veya değiştiremez —
FilePrintsınıfı mevcut PDF/XPS dosyalarını tüketir ve bunları yazıcı kuyruğuna gönderir. -
Yapılandırma Dosyası Odaklı API: Yazıcı adı, kağıt boyutu, kopya sayısı ve "dosyaya yazdırma" modu, güçlü şekilde türlendirilmiş bir seçenekler nesnesi olarak geçilmez,
app.config(Properties.Settings.Default) tarafından okunur. -
Yalnızca Windows + .NET Framework:
net461'yi hedefler ve PdfiumViewer'ın Win32 yerel ikili dosyalarını içine alır. Hiçbir .NET Core / .NET 6+ TFM ve Linux/macOS desteği yok. -
Sınırlı Baskı Düğmeleri: Dubleks, sayfa aralığı, yön ve renk, yazıcı sürücüsünün varsayılanına dayanır - bunlar için birinci sınıf bir API yoktur.
-
Etkin Bakım Yapılmıyor: 1.0.3 (Şubat 2020) sürümünden bu yana hiçbir sürüm yok ve NuGet listesinden bağlantılı bir genel kaynak deposu yok.
-
Düz İstisna Yüzeyi: Hatalar PdfiumViewer / spuler'dan jenerik istisnalar olarak yükseltilir, türlerle belirtilen bir hata hiyerarşisi yerine.
- PDF Oluşturma Yok: PDF oluşturamaz — HTML, bir URL veya görüntülerden yazdırılmış sayfaya gitmek için, PDFFilePrint'i ayrı bir renderer ile eşleştirmelisiniz.
PDFFilePrintvs IronPDF Karşılaştırması
| Aspekt | PDFFilePrint | IronPDF |
|---|---|---|
| Temel Odak | PDF/XPS Yazdırma | Kapsamlı PDF API |
| Tür | Pdfium yazdırma sarmalayıcı | Yerel .NET kütüphanesi + Chromium renderer |
| Entegrasyon | new FilePrint(...).Print() + app.config |
Doğrudan PdfDocument API |
| PDF Yazdırma | Evet | Evet |
| PDF Oluşturma | Hayır | Evet (HTML, URL, resimler) |
| PDF Manipülasyonu | Hayır | Evet (birleştir, böl, düzenle) |
| Çapraz Platform | Sadece Windows için (net461) | Windows, Linux, macOS, Docker |
| Hata Yönetimi | PdfiumViewer'dan düz istisnalar | Türlendirilmiş IronPdfException |
| IntelliSense | Minimum (küçük yüzey) | Tam |
| NuGet Paketi | PDFFilePrint 1.0.3 (MIT, Şubat 2020) |
IronPdf |
| Son sürüm | 1.0.3 (Şubat 2020) | Aktif sürümler |
Modern .NET'i hedefleyen ekipler için (Framework 4.6.2+ ve .NET 6/7/8/9/10), IronPDF, PDFFilePrint'in mimari kısıtlamalarını ele alarak, çapraz platform desteği ve aktif geliştirme ile kapsamlı bir temel sağlar.
Başlamadan Önce
Ön Koşullar
- .NET Environment: .NET Framework 4.6.2+ or .NET 6/7/8/9/10
- NuGet Erişimi: NuGet paketlerini yükleyebilme
- IronPDF Lisansı: Lisans anahtarınızı ironpdf.com adresinden edinin
NuGet Paket Değişiklikleri
# RemovePDFFilePrintpackage
dotnet remove package PDFFilePrint
# Install IronPDF
dotnet add package IronPdf
# RemovePDFFilePrintpackage
dotnet remove package PDFFilePrint
# Install IronPDF
dotnet add package IronPdf
Lisans Yapılandırması
// 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"
PDFFilePrintKullanımını Belirleyin
# FindPDFFilePrintAPI usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
# FindPDFFilePrintAPI usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
Tam API Referansı
Ad Alanı Değişiklikleri
// 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
Çekirdek Sınıf Eşlemeleri
| PDFFilePrint | IronPDF |
|---|---|
new FilePrint(path, null) (yükleme) |
PdfDocument.FromFile(path) |
new ChromePdfRenderer() (eşdeğeri yok —PDFFilePrintPDF oluşturamaz) |
new ChromePdfRenderer() |
FilePrint |
PdfDocument |
PDF Oluşturma Yöntem Eşlemeleri
| PDFFilePrint | IronPDF |
|---|---|
| (mevcut değil) | renderer.RenderHtmlAsPdf(html) |
| (mevcut değil) | renderer.RenderUrlAsPdf(url) |
| (var olmayan – sadece baskı) | pdf.SaveAs(path) |
PDF Yükleme ve Yazdırma Eşlemeleri
| PDFFilePrint | IronPDF |
|---|---|
new FilePrint(path, null) |
PdfDocument.FromFile(path) |
fileprint.Print() (sessiz, her zaman) |
pdf.Print() (sessiz) / pdf.Print(true) (diyalog) |
Properties.Settings.Default.PrinterName = "..." ardından Print() |
pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print() |
Yazdırma Ayarları Eşleme (app.config'ten PrinterSettings'e)
PDFFilePrint Ayarı (Settings.Default) |
IronPDF (System.Drawing.Printing.PrinterSettings) |
|---|---|
PrinterName |
PrinterName |
Copies |
Copies |
| (sessiz bayrak yok — her zaman sessiz) | pdf.Print() (sessiz) / pdf.Print(true) (diyalog göster) |
| (sürücü varsayılanı) | FromPage, ToPage, PrintRange |
| (sürücü varsayılanı) | DefaultPageSettings.Landscape |
| (sürücü varsayılanı) | Duplex |
| (sürücü varsayılanı) | Collate |
PaperName |
DefaultPageSettings.PaperSize |
PrintToFile + DefaultPrintToDirectory |
PrintToFile + PrintFileName |
PDFFilePrint'te Olmayan Yeni Yetenekler
| IronPDF Özelliği | Açıklama |
|---|---|
PdfDocument.Merge() |
Birden fazla PDF'yi birleştir |
pdf.CopyPages() |
Belirli sayfaları çıkar |
pdf.ApplyWatermark() |
Filigran ekleme |
pdf.SecuritySettings |
Parola koruması |
pdf.ExtractAllText() |
Metin içeriği çıkart |
pdf.RasterizeToImageFiles() |
Görüntülere dönüştür |
pdf.SignWithDigitalSignature() |
Dijital imzalar |
Kod Göç Örnekleri
Örnek 1: HTML'den PDF'ye Dönüştürme
Önce (PDFFilePrint):
// NuGet: Install-Package PDFFilePrint
//PDFFilePrintis 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
//PDFFilePrintis 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
Sonrası (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
Buradaki temel fark kapsamdır. PDFFilePrint'in HTML'den PDF'ye geçiş yolu yok — genel yüzeyi mevcut bir PDF'yi yazıcıya veren bir FilePrint sınıfıdır. IronPDF, belge nesnesinden çıktı almayı ayırır: ChromePdfRenderer HTML'den PDF'ye dönüşümü gerçekleştirir ve ardından SaveAs() ile kaydettiğiniz bir PdfDocument döner.
Bu ayrım, dönüşüm öncesi işleme seçeneklerini yapılandırmanıza ve döndürülen PdfDocument'yi (filigran eklemek, diğer PDF'lerle birleştirmek, güvenlik eklemek) kaydetmeden önce düzenlemenize de olanak tanır. HTML'den PDF'ye belgelemeyi ek işleme seçenekleri için inceleyin.
Örnek 2: URL'den PDF'ye Dönüştürme
Önce (PDFFilePrint):
// NuGet: Install-Package PDFFilePrint
//PDFFilePrintcannot 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
//PDFFilePrintcannot 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
Sonrası (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'in URL getirme yeteneği yok. IronPDF, modern CSS, JavaScript ve web özelliklerini işlemek için bir Chromium motorundan yararlanan ChromePdfRenderer üzerinde özel RenderUrlAsPdf() yöntemini kullanır. URL'den PDF'ye dönüşüm hakkında daha fazla bilgi edinin.
Örnek 3: PDF Yazdırma
Önce (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
Sonrası (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
Bu örnek, iki kütüphane arasındaki mimari farkı göstermektedir. PDFFilePrint, new FilePrint(path, null) oluşumu başlatır ve Print() çağırır, yazıcı adı ve kopya sayısı app.config (Properties.Settings.Default) tarafından okunur. IronPDF, yüklemek için statik fabrika PdfDocument.FromFile() kullanır, sonra varsayılan yazıcıyı kullanan Print() kullanır — veya açık denetim için GetPrintDocument(settings).Print() ile bir System.Drawing.Printing.PrinterSettings geçersiniz.
Ana geçiş değişiklikleri:
new FilePrint(path, null)→PdfDocument.FromFile(path)Properties.Settings.Default.PrinterName = "..."+Print()→pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print()- Varsayılan yazıcı:
Settings.DefaultiçindePrinterNameboş bırakın →pdf.Print()çağırın
Gelişmiş baskı ayarları için IronPDF, System.Drawing.Printing.PrinterSettings kullanır. yazdırma belgelerine daha fazla seçenek için bakın.
Gelişmiş Yazdırma Ayarları Göçü
PDFFilePrint'in app.config anahtarlarını kullanan uygulamalar için, IronPDF'in güçlü şekilde türlendirilmiş PrinterSettings'ne nasıl geçileceği:
//PDFFilePrintapproach — 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();
//PDFFilePrintapproach — 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
'PDFFilePrintapproach — 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:
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()
Sessiz Mod
//PDFFilePrintis 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
//PDFFilePrintis 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
' PDFFilePrintis 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
Geçiş Sonrası Yeni Özellikler
IronPDF'e geçişten sonra, PDFFilePrint'in sağlayamadığı yetenekler kazanırsınız:
Tek Adımda Oluşturma ve Yazdırma
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()
PDF Birleştirme
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")
Filigranlar
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")
Şifre Koruma
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")
Metin Çıkarma
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()
Kritik Taşıma Notları
Sınıf Deseni Değişikliği
PDFFilePrint, app.config tarafından yönlendirilen tek bir Print() yöntemi olan küçük bir FilePrint sınıfı kullanır. IronPDF, render etme, belge manipülasyonu ve yazdırmayı farklı türlere ayırır:
// 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 —PDFFilePrintcannot
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 —PDFFilePrintcannot
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 — PDFFilePrint cannot
Dim renderer = New ChromePdfRenderer()
Dim newPdf = renderer.RenderHtmlAsPdf(html)
newPdf.SaveAs(path)
Yöntem / Ayar Adlandırma Değişiklikleri
//PDFFilePrint→ 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 = ...
//PDFFilePrinthas no native HTML/URL/merge/watermark methods — these are IronPDF-only.
//PDFFilePrint→ 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 = ...
//PDFFilePrinthas no native HTML/URL/merge/watermark methods — these are IronPDF-only.
' PDFFilePrint→ IronPDF
PdfDocument.FromFile(path)
' pdf.Print() // silent default
pdf.Print()
' new PrinterSettings { PrinterName = "X" }
Dim printerSettings As New PrinterSettings With {
.PrinterName = "X"
}
' new PrinterSettings { Copies = 3 }
printerSettings.Copies = 3
' settings.DefaultPageSettings.PaperSize = ...
settings.DefaultPageSettings.PaperSize = New PaperSize("A4", 827, 1169)
' PDFFilePrinthas no native HTML/URL/merge/watermark methods — these are IronPDF-only.
İstisna Yönetimi
// PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
try {
new FilePrint(path, null).Print();
}
catch (Exception ex) {
//Hayırgranular 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) {
//Hayırgranular error type — log the message and inner exception.
}
// IronPDF: typed exception hierarchy
try {
pdf.Print();
}
catch (IronPdf.Exceptions.IronPdfException ex) {
// Granular error details
}
Imports PdfiumViewer
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
' Hayırgranular 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
Hiçbir Dış Yürütülebilir Yok
Her iki kütüphane de NuGet paketleri olarak gönderilir. Bağlanacak veya kaldırılacak herhangi bir PDFFilePrint.exe yoktur —PDFFilePrinttarafında dotnet remove package PDFFilePrint yeterlidir. IronPDF, aynı şekilde yeniden yükleme sırasında doğal bağımlılıkları çözen IronPdf paketi aracılığıyla kendinden yeterlidir.
Özellik Karşılaştırması Özeti
| Özellik | PDFFilePrint | IronPDF |
|---|---|---|
| Temel yazdırma | ✓ | ✓ |
| Gizli yazdırma | ✓ (her zaman sessiz) | ✓ |
| Birden fazla kopya | ✓ (app.config üzerinden) | ✓ |
| Sayfa aralığı | Yalnızca sürücü varsayılanı | ✓ |
| Çift taraflı yazdırma | Yalnızca sürücü varsayılanı | ✓ |
| HTML'den Oluştur | ✗ | ✓ |
| URL'den Oluştur | ✗ | ✓ |
| PDF'leri birleştir | ✗ | ✓ |
| PDF Ayırma | ✗ | ✓ |
| Filigran ekleme | ✗ | ✓ |
| Metin çıkar | ✗ | ✓ |
| Parola koruması | ✗ | ✓ |
| Dijital imzalar | ✗ | ✓ |
| Çapraz platform | ✗ (Windows / net461) | ✓ |
| Yerel .NET API | ✓ (küçük yüzey) | ✓ |
Geçiş Kontrol Listesi
Öncesi-Geçiş
- Tüm
using PDFFilePrint;venew FilePrint(...)çağrı yerlerini bulun - Mevcut
app.configayarlarını belgeleyin (PrinterName,PaperName,Copies,PrintToFile,DefaultPrintToDirectory) - Çeşitli ortamlarda kullanılan yazıcı adlarını belirleyin
- Çalışma zamanında
Properties.Settings.Default'yi değiştiren herhangi bir kodu not alın - Yeni özellik fırsatlarını belirleyin (HTML/URL render etme, birleştirme, filigranlar, güvenlik) -IronPDF lisans anahtarını edinin
Paket Değişiklikleri
PDFFilePrintNuGet paketini kaldırın:dotnet remove package PDFFilePrintIronPdfNuGet paketini yükleyin:dotnet add package IronPdfusing PDFFilePrint;'yiusing IronPdf;ile değiştirin (gerektiğindeusing System.Drawing.Printing;ekleyin)
Kod Değişiklikleri
Başlangıçta lisans anahtarı yapılandırmasını ekleyin
new FilePrint(path, null)'yıPdfDocument.FromFile(path)ile değiştirin- Yazıcı/kopya/kağıt ayarlarını
app.configdışına veSystem.Drawing.Printing.PrinterSettingsiçine taşıyın - Sessiz varsayılan yazıcı çıkışı için
pdf.Print()kullanın, veya açık seçenekler içinpdf.GetPrintDocument(settings).Print()kullanın - Daha önce genel istisnaları yakaladığınız yerde,
Print()çağrılarınıtry/catch IronPdfExceptionile sarın - HTML/URL/birleştirme/filigran özellikleri için (PDFFilePrint'in asla sunmadığı),
ChromePdfRenderervePdfDocumentdüzenleme API'sini kullanın
Geçiş Sonrası
app.config'dan PDFFilePrint'e özgü anahtarları kaldırın- Tüm hedef yazıcılarda yazdırmayı test edin
- Mümkünse çapraz platform test edin (Linux yazdırma CUPS gerektirir)
- Gerekli olduğunda yeni özellikler ekleyin (filigranlar, güvenlik, birleştirme)
- Belgeleri güncelleyin

