RemoveDuplicateResources Свойство (PdfDocumentCompressorCommand)
В этом разделе
Возвращает или задает значение, указывающее, должна ли команда удалять дубликаты ресурсов из PDF документа.
Синтаксис
Property Value
True - команда должна удалять дубликаты ресурсов; false - команда НЕ должна удалять дубликаты ресурсов.
Значение по умолчанию: true.
Пример
Вот пример, показывающий, как удалить неиспользуемые и дубликаты ресурсов в PDF документе:
''' <summary>
''' Removes unused and duplicated resources in the PDF document.
''' </summary>
''' <param name="inPdfFilename">The input PDF filename.</param>
''' <param name="outPdfFilename">The output PDF filename.</param>
Public Shared Sub RemoveUnsusedResources(inPdfFilename As String, outPdfFilename As String)
' create compressor with empty compression settings
Dim compressor As Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand = Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor()
' specify that compressor must remove duplicate resources from PDF document
compressor.RemoveDuplicateResources = True
' specify that compressor must remove unused names resources from PDF document
compressor.RemoveUnusedNamedResources = True
' specify that compressor must remove unused names from PDF document
compressor.RemoveUnusedNames = True
' specify that compressor must remove unused pages from PDF document
compressor.RemoveUnusedPages = True
' specify that compressor must remove invalid bookmarks from PDF document
compressor.RemoveInvalidBookmarks = True
' specify that compressor must remove invalid links from PDF document
compressor.RemoveInvalidLinks = True
' compress PDF document
compressor.Compress(inPdfFilename, outPdfFilename)
End Sub
/// <summary>
/// Removes unused and duplicated resources in the PDF document.
/// </summary>
/// <param name="inPdfFilename">The input PDF filename.</param>
/// <param name="outPdfFilename">The output PDF filename.</param>
public static void RemoveUnsusedResources(string inPdfFilename, string outPdfFilename)
{
// create compressor with empty compression settings
Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand compressor =
Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor();
// specify that compressor must remove duplicate resources from PDF document
compressor.RemoveDuplicateResources = true;
// specify that compressor must remove unused names resources from PDF document
compressor.RemoveUnusedNamedResources = true;
// specify that compressor must remove unused names from PDF document
compressor.RemoveUnusedNames = true;
// specify that compressor must remove unused pages from PDF document
compressor.RemoveUnusedPages = true;
// specify that compressor must remove invalid bookmarks from PDF document
compressor.RemoveInvalidBookmarks = true;
// specify that compressor must remove invalid links from PDF document
compressor.RemoveInvalidLinks = true;
// compress PDF document
compressor.Compress(inPdfFilename, outPdfFilename);
}
Требования
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также