Product Info
TestimonialsBeen a self employed software engineer myself, i cannot tell you enough how i appreciate your professionalism and your work. Yannis Sferopoulos |
VintaSoftPDF.NET Plug-in - FAQGeneral questions:
Redistribution:
PDF:
Programming:
For which purposes can I use the VintaSoftPDF.NET Plug-in?You can use it as plug-in for VintaSoftImaging.NET SDK and it will allow you display, render, create, convert, annotate, print, save, manipulate and edit pages of PDF files.
From which parts does the plug-in consist?The library contains:
In which programming languages can I use the plug-in?With Single Developer license or Site license you can use component in:
With Server license you can use component in:
What restrictions does the unregistered version have?Unregistered version has the following restrictions:
All these restrictions are removed in registered version.
I have problems. What should I do?Answers to most of questions can be found in the documentation or in this FAQ. Please write to our support team to get more help.
What files do I need to include in the setup package of my program?You need include two files: VintaSoft.Imaging.dll and Vintasoft.PDF.dll. These files must be placed in the same folder as the assembly that references them. Make sure that the version you distribute is the version your assembly was compiled with.
Can I re-distribute Vintasoft.PDF.dll with my application without royalties?Yes, this component is royalty free. You pay only for registration one time. Only Vintasoft.PDF.dll can be re-distributed with your application. Site license has no limitations in re-distribution. Single Developer license has limitation in re-distribution. Server license is not royalty free. Please read the license agreement for more information.
I cannot open PDF file using your library. What should I do?Please send us your "bad" file. We will analyze it and update our reading algorithm if image is correct.
PDF document is displayed incorrectly. What should I do?It's possible that while a page was generated:
Error (PDFRuntimeError): appear when there was an attempt to draw unsupported element (e.g. JPEG2000 image), or an internal error occur in the library. Errors at page elements drawing indicate that the page was drawn incorrectly. Warning (PDFRuntimeWarning): appear when there were used unsupported color correction functions (e.g. ICCProfile). The warning means that the element has been completely drawn, but this color correction function did not apply. In the current version of library are unsupported:
Errors and warnings may also occur during saving a file to PDF/A. To find out whether the document was drawn correctly (are there any unsupported elements or occur errors), it is necessary to use property PDFDocument.RuntimeMessages. Here is an example of code to calculate the errors / warnings in the document:
[VB.NET]
Public Shared Sub TestDocument(ByVal fileName As String, ByRef errors As Integer, ByRef warnings As Integer)
' open document
Dim document As New PdfDocument(fileName)
errors = 0
warnings = 0
For i As Integer = 0 To document.Pages.Count - 1
' clear messages
document.RuntimeMessages.Clear()
' renderer page
Dim pageImage As VintasoftImage = document.Pages(i).Render()
pageImage.Dispose()
' check messages
For Each message As PdfRuntimeMessage In document.RuntimeMessages
If TypeOf message Is PdfRuntimeWarning Then
warnings += 1
ElseIf TypeOf message Is PdfRuntimeError Then
errors += 1
End If
Next
Next
End Sub
[C#]
public static void TestDocument(string fileName, out int errors, out int warnings)
{
// open document
PdfDocument document = new PdfDocument(fileName);
errors = 0;
warnings = 0;
for (int i = 0; i < document.Pages.Count; i++)
{
// clear messages
document.RuntimeMessages.Clear();
// render the page
VintasoftImage pageImage = document.Pages[i].Render();
pageImage.Dispose();
// check messages
foreach (PdfRuntimeMessage message in document.RuntimeMessages)
{
if (message is PdfRuntimeWarning)
warnings++;
else if (message is PdfRuntimeError)
errors++;
}
}
}
If the document was drawn with error, but the library has not reported about this error, or if an error occur and it is not related with unsupported elements — send your PDF document to VintaSoft support team for further review and debugging.
How do I pack PDF document?Packing (PDFDocument.Pack) allows:
Usage of PDFDocument.Optimize functions allows to set a way of compression for different objects: color images, black-and-white images, data. Before the end of work the Optimize function will call the pack function. Here is an example that shows how to pack PDF file (optimize=false) or how to pack PDF file and convert all color images to JPEG (optimize=true):
[VB.NET]
Public Shared Sub PackPdf(ByVal pdfFileName As String, ByVal optimize As Boolean)
' open PDF document to Read/Write
Dim pdfDocument As New PdfDocument(pdfFileName)
' create PdfFormat - 1.6 format, with compressed coross-reference table
Dim format As New PdfFormat("1.6", True, True)
If optimize Then
' set JPEG Quality to 80
PdfCompressionSettings.DefaultSettings.JpegQuality = 80
' create optimize settings
' compression for Color images - JPEG
' compression for B/W images - not change
Dim optimizeSettings As New PdfOptimizeSettings(PdfCompression.Jpeg, PdfCompression.Undefined, PdfCompression.Undefined)
' compression for Data - not change
' optimize and Pack document
pdfDocument.Optimize(format, optimizeSettings)
Else
' pack document
pdfDocument.Pack(format)
End If
' free resources
pdfDocument.Dispose()
End Sub
[C#]
public static void PackPdf(string pdfFileName, bool optimize)
{
// open PDF document to Read/Write
PdfDocument pdfDoument = new PdfDocument(pdfFileName);
// create PdfFormat - 1.6 format, with compressed cross-reference table
PdfFormat format = new PdfFormat("1.6", true, true);
if (optimize)
{
// set JPEG Quality to 80
PdfCompressionSettings.DefaultSettings.JpegQuality = 80;
// create optimize settings
PdfOptimizeSettings optimizeSettings = new PdfOptimizeSettings(
PdfCompression.Jpeg, //compression for Color images - JPEG
PdfCompression.Undefined, //compression for B/W images - not changed
PdfCompression.Undefined); //compression for Data - not changed
// optimize and Pack document
pdfDoument.Optimize(format, optimizeSettings);
}
else
{
// pack document
pdfDoument.Pack(format);
}
// free resources
pdfDoument.Dispose();
}
What should I do when there is no font found?Font search algorithm by default is as follows: the search starts in the directory $ASSEMBLY_DIRECTORY$\Fonts\, if there is no font found it begins to search the fonts installed in the system (information from the registry). When the font was not found you should place it in the directory $ASSEMBLY_DIRECTORY$\Fonts\ or install to the system. You must also take into account that the search occur by the font's common name, not in PostScript style. If you want redefine the font search algorithm, then you must create an implementation of IfontProgramsController interface or an inheritor from any implementation of this interface (SystemFontProgramsController, UserAndSystemFontProgramsController). After it is necessary to initialize property PDFDocument.FontProgramsController using an instance of created by you class.
How to convert PDF to TIFF?Here is an example that shows how to convert PDF document to TIFF file using image collection and TiffEncoder:
[VB.NET]
Public Shared Sub ConvertPdfToTiff_1(ByVal pdfFileName As String, ByVal tiffFileName As String)
' create ImageCollection
Dim imageCollection As New ImageCollection()
' add PDF document to collecion
imageCollection.Add(pdfFileName)
' create TiffEncoder
Dim tiffEncoder As New TiffEncoder(True)
' set TIFF compression to Zip
tiffEncoder.Compression = TiffCompression.Zip
' save pages use TIFF encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder)
' free resources
tiffEncoder.Dispose()
imageCollection.Dispose()
End Sub
[C#]
public static void ConvertPdfToTiff_1(string pdfFileName, string tiffFileName)
{
// create ImageCollection
ImageCollection imageCollection = new ImageCollection();
// add PDF document to collecion
imageCollection.Add(pdfFileName);
// create TiffEncoder
TiffEncoder tiffEncoder = new TiffEncoder(true);
// set TIFF compression to Zip
tiffEncoder.Compression = TiffCompression.Zip;
// save pages using TIFF encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder);
// free resources
tiffEncoder.Dispose();
imageCollection.Dispose();
}
Here is an example that shows how to convert PDF document to TIFF file using PdfDocument and TiffFile:
[VB.NET]
Public Shared Sub ConvertPdfToTiff_2(ByVal pdfFileName As String, ByVal tiffFileName As String)
' open PDF document
Dim pdfDocument As New PdfDocument(pdfFileName)
' create TIFF File
Dim tiffFile As New TiffFile(tiffFileName, True)
' set TIFF compression to Zip
tiffFile.Compression = TiffCompression.Zip
' foreach PDF pages
For i As Integer = 0 To pdfDocument.Pages.Count - 1
' in TiffFile add rendered PDF page
tiffFile.Pages.Add(pdfDocument.Pages(i).Render())
Next
' free resources
pdfDocument.Dispose()
tiffFile.Dispose()
End Sub
[C#]
public static void ConvertPdfToTiff_2(string pdfFileName, string tiffFileName)
{
// open PDF document
PdfDocument pdfDocument = new PdfDocument(pdfFileName);
// create TIFF File
TiffFile tiffFile = new TiffFile(tiffFileName, true);
// set TIFF compression to Zip
tiffFile.Compression = TiffCompression.Zip;
// for each PDF pages
for (int i = 0; i < pdfDocument.Pages.Count; i++)
{
// add rendered PDF page to TiffFile
tiffFile.Pages.Add(pdfDocument.Pages[i].Render());
}
// free resources
pdfDocument.Dispose();
tiffFile.Dispose();
}
How to convert PDF to TIFF with defined resolution (dpi)?Here is an example that shows how to convert PDF document to TIFF file (with defined resolution and given drawing parameters) using image collection and PdfEncoder:
[VB.NET]
Public Shared Sub ConvertPdfToTiffDPI_1(ByVal pdfFileName As String, ByVal tiffFileName As String, ByVal dpi As Single)
' create ImageCollection
Dim imageCollection As New ImageCollection()
' set rendering settings
imageCollection.RenderingSettings = New RenderingSettings(dpi, dpi,_
System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear,_
System.Drawing.Drawing2D.SmoothingMode.AntiAlias)
' add PDF document to collecion
imageCollection.Add(pdfFileName)
' create TiffEncoder
Dim tiffEncoder As New TiffEncoder(True)
' set TIFF compression to Zip
tiffEncoder.Compression = TiffCompression.Zip
' save pages use TIFF encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder)
' free resources
tiffEncoder.Dispose()
imageCollection.Dispose()
End Sub
[C#]
public static void ConvertPdfToTiffDPI_1(string pdfFileName, string tiffFileName, float dpi)
{
// create ImageCollection
ImageCollection imageCollection = new ImageCollection();
// set rendering settings
imageCollection.RenderingSettings = new RenderingSettings(
dpi,
dpi,
System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear,
System.Drawing.Drawing2D.SmoothingMode.AntiAlias);
// add PDF document to collecion
imageCollection.Add(pdfFileName);
// create TiffEncoder
TiffEncoder tiffEncoder = new TiffEncoder(true);
// set TIFF compression to Zip
tiffEncoder.Compression = TiffCompression.Zip;
// save pages using TIFF encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder);
// free resources
tiffEncoder.Dispose();
imageCollection.Dispose();
}
Here is an example that shows how to convert PDF document to TIFF file (with defined resolution and given drawing parameters) using PdfDocument and TiffFile:
[VB.NET]
Public Shared Sub ConvertPdfToTiffDPI_2(ByVal pdfFileName As String, ByVal tiffFileName As String, ByVal dpi As Single)
' open PDF document
Dim pdfDocument As New PdfDocument(pdfFileName)
' set resolution
pdfDocument.RenderingSettings.Resolution = New Resolution(dpi, dpi)
' set rendering mode - optimal balance between rendering speed and rendering quality.
pdfDocument.RenderingSettings.RenderingMode = PdfRenderingMode.Normal
' create TIFF File
Dim tiffFile As New TiffFile(tiffFileName, True)
' set TIFF compression to Zip
tiffFile.Compression = TiffCompression.Zip
' foreach PDF pages
For i As Integer = 0 To pdfDocument.Pages.Count - 1
' in TiffFile add rendered PDF page
tiffFile.Pages.Add(pdfDocument.Pages(i).Render())
Next
' free resources
pdfDocument.Dispose()
tiffFile.Dispose()
End Sub
[C#]
public static void ConvertPdfToTiffDPI_2(string pdfFileName, string tiffFileName, float dpi)
{
// open PDF document
PdfDocument pdfDocument = new PdfDocument(pdfFileName);
// set resolution
pdfDocument.RenderingSettings.Resolution = new Resolution(dpi, dpi);
// set rendering mode - optimal balance between rendering speed and rendering quality.
pdfDocument.RenderingSettings.RenderingMode = PdfRenderingMode.Normal;
// create TIFF File
TiffFile tiffFile = new TiffFile(tiffFileName, true);
// set TIFF compression to Zip
tiffFile.Compression = TiffCompression.Zip;
// for each PDF pages
for (int i = 0; i < pdfDocument.Pages.Count; i++)
{
// add rendered PDF page to TiffFile
tiffFile.Pages.Add(pdfDocument.Pages[i].Render());
}
// free resources
pdfDocument.Dispose();
tiffFile.Dispose();
}
How to convert TIFF to PDF?Here is an example that shows how to convert TIFF file to PDF document using image collection and PdfEncoder:
[VB.NET]
Public Shared Sub ConvertTiffToPdf_1(ByVal tiffFileName As String, ByVal pdfFileName As String)
' create ImageCollection
Dim imageCollection As New ImageCollection()
' add PDF document to collecion
imageCollection.Add(tiffFileName)
' create TiffEncoder
Dim pdfEncoder As New PdfEncoder(True)
' set PDF compression to Zip
pdfEncoder.Settings.Compression = PdfImageCompression.Zip
' save pages use PDF encoder
imageCollection.SaveSync(pdfFileName, pdfEncoder)
' free resources
pdfEncoder.Dispose()
imageCollection.Dispose()
End Sub
[C#]
public static void ConvertTiffToPdf_1(string tiffFileName, string pdfFileName)
{
// create ImageCollection
ImageCollection imageCollection = new ImageCollection();
// add TIFF file to collecion
imageCollection.Add(tiffFileName);
// create TiffEncoder
PdfEncoder pdfEncoder = new PdfEncoder(true);
// set PDF compression to Zip
pdfEncoder.Compression = PdfImageCompression.Zip;
// save pages using PDF encoder
imageCollection.SaveSync(pdfFileName, pdfEncoder);
// free resources
pdfEncoder.Dispose();
imageCollection.Dispose();
}
Here is an example that shows how to convert TIFF file to PDF document using PdfDocument and TiffFile:
[VB.NET]
Public Shared Sub ConvertTiffToPdf_2(ByVal tiffFileName As String, ByVal pdfFileName As String)
' create TIFF File
Dim tiffFile As New TiffFile(tiffFileName)
' create new PdfDocument, version 1.4
Dim pdfDocument As New PdfDocument(pdfFileName, FileMode.Create, FileAccess.Write, PdfFormat.Pdf_14)
' foreach TIFF pages
For i As Integer = 0 To tiffFile.Pages.Count - 1
' add TIFF page to PDF document
pdfDocument.Pages.Add(tiffFile.Pages(i).GetImage().GetImage(), PdfCompression.Zip)
' drop changes to disk
pdfDocument.SaveChanges()
Next
' free resources
pdfDocument.Dispose()
tiffFile.Dispose()
End Sub
[C#]
public static void ConvertTiffToPdf_2(string tiffFileName, string pdfFileName)
{
// create TIFF File
TiffFile tiffFile = new TiffFile(tiffFileName);
// create new PdfDocument, version 1.4
PdfDocument pdfDocument = new PdfDocument(
pdfFileName,
FileMode.Create,
FileAccess.Write,
PdfFormat.Pdf_14);
// for each TIFF page
for (int i = 0; i < tiffFile.Pages.Count; i++)
{
// add TIFF page to PDF document
pdfDocument.Pages.Add(tiffFile.Pages[i].GetImage(), PdfCompression.Zip);
// drop changes to disk
pdfDocument.SaveChanges();
}
// free resources
pdfDocument.Dispose();
tiffFile.Dispose();
}
How to convert TIFF to PDF/A?Here is an example that shows how to convert TIFF file to PDF/A document using image collection and PdfEncoder:
[VB.NET]
Public Shared Sub ConvertTiffToPdfA_1(ByVal tiffFileName As String, ByVal pdfFileName As String)
' create ImageCollection
Dim imageCollection As New ImageCollection()
' add PDF document to collecion
imageCollection.Add(pdfFileName)
' create TiffEncoder
Dim pdfEncoder As New PdfEncoder(True)
' set PDF compression to Zip
pdfEncoder.Settings.Compression = PdfImageCompression.Zip
' set PDF/A compatible
pdfEncoder.Settings.PdfACompatible = True
' save pages use PDF encoder
imageCollection.SaveSync(tiffFileName, pdfEncoder)
' free resources
pdfEncoder.Dispose()
imageCollection.Dispose()
End Sub
[C#]
public static void ConvertTiffToPdfA_1(string tiffFileName, string pdfFileName)
{
// create ImageCollection
ImageCollection imageCollection = new ImageCollection();
// add PDF document to collection
imageCollection.Add(pdfFileName);
// create TiffEncoder
PdfEncoder pdfEncoder = new PdfEncoder(true);
// set PDF compression to Zip
pdfEncoder.Compression = PdfImageCompression.Zip;
// set PDF/A compatible
pdfEncoder.PdfACompatible = true;
// save pages using PDF encoder
imageCollection.SaveSync(tiffFileName, pdfEncoder);
// free resources
pdfEncoder.Dispose();
imageCollection.Dispose();
}
Here is an example that shows how to convert TIFF file to PDF/A document using PdfDocument and TiffFile:
[VB.NET]
Public Shared Sub ConvertTiffToPdfA_2(ByVal tiffFileName As String, ByVal pdfFileName As String)
' create TIFF File
Dim tiffFile As New TiffFile(tiffFileName)
' create new PDF/A compatible PdfDocument
Dim pdfDocument As New PdfDocument(pdfFileName, FileMode.Create, FileAccess.Write, PdfFormat.Pdf_A)
' foreach TIFF pages
For i As Integer = 0 To tiffFile.Pages.Count - 1
' add TIFF page to PDF document
pdfDocument.Pages.Add(tiffFile.Pages(i).GetImage().GetImage(), PdfCompression.Zip)
' drop changes to disk
pdfDocument.SaveChanges()
Next
' free resources
pdfDocument.Dispose()
tiffFile.Dispose()
End Sub
[C#]
public static void ConvertTiffToPdfA_2(string tiffFileName, string pdfFileName)
{
// create TIFF File
TiffFile tiffFile = new TiffFile(tiffFileName);
// create new PDF/A compatible PdfDocument
PdfDocument pdfDoument = new PdfDocument(
pdfFileName,
FileMode.Create,
FileAccess.Write,
PdfFormat.Pdf_A);
// for each TIFF page
for (int i = 0; i < tiffFile.Pages.Count; i++)
{
// add TIFF page to PDF document
pdfDocument.Pages.Add(tiffFile.Pages[i].GetImage(), PdfCompression.Zip);
// drop changes to disk
pdfDocument.SaveChanges();
}
// free resources
pdfDocument.Dispose();
tiffFile.Dispose();
}
|