It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

PDF-XChange Editor SDK for Developers

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
MansourDalir
User
Posts: 7
Joined: Sun Sep 01, 2024 10:02 am

It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by MansourDalir »

This feature is only for PDF whose content is a photo (bitmap). The method of detecting repetition should be like this. Looking horizontally linearly and vertically linearly When a duplicate page is found, the user deletes the pages.Or if this software has such a possibility, I would be grateful if you could help me
Image
Attachments
image(1).png
image.png
image.png (16.08 KiB) Viewed 3377 times
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10880
Joined: Wed Jan 03, 2018 6:52 pm

Re: It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by Daniel - PDF-XChange »

Hello, MansourDalir

Thank you for the suggestion, I believe this has come up in the past, but I will bring it by the Dev team again today and see what they think.

[Edit:] A ticket has been made for this request:
RT#7090: FR: Add "find duplicate page" feature

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
MansourDalir
User
Posts: 7
Joined: Sun Sep 01, 2024 10:02 am

Re: It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by MansourDalir »

I wrote a piece of code that can find duplicate pages. Maybe it can speed things up a bit. The code is in VB language. I don't know what is the base language of your application.

Code: Select all

Imports System.Runtime.InteropServices
Public Class frmDuplicateImageFinder

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim bmpFiles As New List(Of String)
        For Each foundFile As String In My.Computer.FileSystem.GetFiles(txtRootPath.Text, FileIO.SearchOption.SearchTopLevelOnly, "*bmp")
            bmpFiles.Add(foundFile)
        Next
        GetDulicateImage(bmpFiles.ToArray)
    End Sub
    Function GetDulicateImage(InFiles As String())
        Dim ResultUnique As New List(Of String)
        Dim ResultDuplicate As New List(Of String)
        Dim PixelsFile As New Dictionary(Of String, String)
        For Each CurrentFile In InFiles
            Dim EveryFilePixel As String = GetPixelsFile(CurrentFile)
            If Not PixelsFile.Keys.Contains(EveryFilePixel) Then
                PixelsFile.Add(EveryFilePixel, "Uniqe(" & My.Computer.FileSystem.GetName(CurrentFile) & ")")
                ResultUnique.Add(CurrentFile)
            Else
                PixelsFile(EveryFilePixel) += "_" & My.Computer.FileSystem.GetName(CurrentFile)
                ResultDuplicate.Add(CurrentFile)
            End If
        Next
        My.Computer.FileSystem.CreateDirectory(txtDuplicate.Text)
        My.Computer.FileSystem.CreateDirectory(txtUnique.Text)
        For Each file In ResultDuplicate.ToArray
            My.Computer.FileSystem.MoveFile(file, txtDuplicate.Text & "\" & My.Computer.FileSystem.GetName(file))
        Next
        For Each file In ResultUnique.ToArray
            My.Computer.FileSystem.MoveFile(file, txtUnique.Text & "\" & My.Computer.FileSystem.GetName(file))
        Next
        txtResultDup.Text = Join(PixelsFile.Values.ToArray, vbNewLine)
        MsgBox("Duplicate File " & ResultDuplicate.Count)
    End Function
    Function GetPixelsFile(Path As String) As String
        Dim RecCheck As New List(Of Rectangle)
        Dim Pixels As New List(Of String)
        Dim RecPixel As String = ""
        Dim bm As Bitmap = New Bitmap(Path)
        'Here, a user's choice needs to be set, such as the number of vertical or horizontal lines
        Dim Len As Integer = 10 'Set By User
        Dim per As Integer = 6 'Set By User
        For Vertical = bm.Width / per To bm.Width Step (bm.Width / per) - 1
            RecCheck.Add(New Rectangle With {.X = Vertical, .Y = bm.Height / 2 - Len / 2, .Width = 1, .Height = Len})
        Next
        For Horizontal = bm.Height / per To bm.Height Step (bm.Height / per) - 1
            RecCheck.Add(New Rectangle With {.X = bm.Width / 2 - Len / 2, .Y = Horizontal, .Width = Len, .Height = 1})
        Next

        For Each Check As Rectangle In RecCheck
            Dim rec As New Rectangle(Check.X, Check.Y, Check.Width, Check.Height)
            Dim bmpData As System.Drawing.Imaging.BitmapData = bm.LockBits(rec, Drawing.Imaging.ImageLockMode.ReadOnly, Imaging.PixelFormat.Format32bppArgb)
            Pixels.Add(GetStringOfPixel(bmpData))
            bm.UnlockBits(bmpData)
        Next
        bm.Dispose()
        RecPixel = Join(Pixels.ToArray, "")
        Return RecPixel
    End Function
End Class
joxeme
User
Posts: 55
Joined: Wed Jul 31, 2024 5:10 am

Re: It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by joxeme »

Dont understand, the new 10.5 has a New feature of "Duplicate pages" (great tool btw), not "Find duplicate pages", no?
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10880
Joined: Wed Jan 03, 2018 6:52 pm

Re: It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by Daniel - PDF-XChange »

Hello, joxeme

Find duplicate pages does indeed exist in the new release:
image.png
Please give it a try, the implementation is quite robust.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
joxeme
User
Posts: 55
Joined: Wed Jul 31, 2024 5:10 am

Re: It is suggested to add an option named (Find Duplicate Page) to the menu 'More For Pages' for this popular software.

Post by joxeme »

Oooh i see, thank you (i didn't know there was a Duplicate pages feature too!!), 2 good tools discovered, keep the good job!!

Best regards,
Post Reply