简体   繁体   English

系统地注释PDF

[英]Systematically annotate a PDF

I have a large PDF file with several hundred pages. 我有一个包含数百页的大型PDF文件。 Each page of the PDF contains a chart and also includes a unique identifier (the chart number). PDF的每个页面都包含一个图表,还包含一个唯一标识符(图表编号)。

I have individual comments for each chart and would like to insert these in the corresponding PDF page, eg chart comment 34 goes in PDF page containing chart 34. 我对每个图表都有个别评论,并希望在相应的PDF页面中插入这些评论,例如图表评论34在包含图表34的PDF页面中。

My current approach is to insert these comments manually, one by one, using the comment tool in Adobe Acrobat Pro. 我目前的方法是使用Adobe Acrobat Pro中的注释工具逐个手动插入这些注释。 This takes time as you can imagine. 这需要时间,你可以想象。

Is there a way to speed up this process? 有没有办法加快这个过程? Ideally, I would have all my comments in a spreadsheet (and less ideal, Python) with the chart code next to it. 理想情况下,我会将所有注释放在电子表格(不太理想,Python)中,旁边有图表代码。 Then, comments would be written to the PDF. 然后,评论将被写入PDF。

Any ideas how this can be done? 有什么想法可以做到这一点?

Can you convert the PDF to a text file, save it, import it, and do a search for the 'comments'? 您可以将PDF转换为文本文件,保存,导入并搜索“评论”吗? I'm not sure what the logic would be, and you didn't post any code here, but my code below will iterate through a text file and find all incidents of a string, let's say it is called 'test' and 'application'. 我不确定逻辑是什么,你没有在这里发布任何代码,但是下面的代码将迭代一个文本文件并查找字符串的所有事件,假设它被称为'test'和'application ”。

Sub ReadFile()
Open "C:\Users\rshuell001\Desktop\sample.txt" For Input As #1
lRow = 1

Do While Not EOF(1)
    Line Input #1, Data
    Data = Application.WorksheetFunction.Trim(Data)
sData = Split(Data, " ")

    With Sheet1
        lColumn = 1
        For intCount = LBound(sData) To UBound(sData)
            .Cells(lRow, lColumn) = sData(intCount)
            lColumn = lColumn + 1
        Next intCount
    End With
    lRow = lRow + 1

Loop

Close #1

Call CopyOver

End Sub

Sub CopyOver()

Dim Rng As Range, cell As Range
Dim rw As Long
Set Rng = Worksheets("Sheet1").Range("B1:B20")
rw = 1
For Each cell In Rng

If Left(cell.Value, 4) = "test" Then
    If Left(cell.Value, 4) = "test" And cell.Offset(0, -1) = "application:" Then
    GoTo ExitPoint
    Else
    Worksheets("Sheet2").Cells(rw, "A") = cell.Value
    Worksheets("Sheet2").Cells(rw + 1, "A") = cell.Offset(1, 0)
    Worksheets("Sheet2").Cells(rw + 2, "A") = cell.Offset(3, 0)
    Worksheets("Sheet2").Cells(rw + 2, "B") = cell.Offset(3, 1)
ExitPoint:
    rw = rw + 2
    End If
End If
Next


End Sub

Before: 之前:

在此输入图像描述

After: 后:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM