<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Zeke – the issue here isn’t specific to deletion of annotations but is related to the PDF file format and it’s support for “incremental updates”.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">When saving changes to a PDF, they can either be saved by simply appending them as part of an increment update section (which includes not only new or changed objects, but a list of deleted objects). This
is the most common way to save things because it is faster. You will find that 99% of all PDF processing tools do this by default.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Alternatively, software could do a “full save” or a “Save As”, where objects no longer in use are “garbage collected”. Poppler does not offer this option.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Leonard<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">poppler <poppler-bounces@lists.freedesktop.org> on behalf of Zeke Williams <lakeleaf8@gmail.com><br>
<b>Date: </b>Friday, September 23, 2022 at 9:20 AM<br>
<b>To: </b>poppler@lists.freedesktop.org <poppler@lists.freedesktop.org><br>
<b>Subject: </b>[poppler] There is a flaw with poppler that needs to be fixed. Deleted annotations are not actually deleted. I require assistance in fixing this.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">EXTERNAL: Use caution when clicking on links or opening attachments.<br>
<br>
<br>
I require assistance as I am not a very proficient C++ programmer with<br>
this issue with poppler. What happens with poppler is that the portion<br>
of the PDF document that shows the annotation is deleted when you<br>
delete an annotation in such as okular or evince, but the actual<br>
contents is in a separate part of the document and that doesn't get<br>
deleted. Meaning in other words, it's still there. That is a privacy<br>
violation that should be fixed. I believe this is the part of poppler<br>
that removes the annotation:<br>
<br>
bool Annots::removeAnnot(Annot *annot)<br>
{<br>
auto idx = std::find(annots.begin(), annots.end(), annot);<br>
<br>
if (idx == annots.end()) {<br>
return false;<br>
} else {<br>
annot->decRefCnt();<br>
annots.erase(idx);<br>
return true;<br>
}<br>
}<br>
<br>
And from another PDF reader (PDF4QT) here is how it removes them:<br>
<br>
void PDFDocumentBuilder::removeAnnotation(PDFObjectReference page,<br>
PDFObjectReference annotation)<br>
{<br>
PDFDocumentDataLoaderDecorator loader(&m_storage);<br>
<br>
if (const PDFDictionary* pageDictionary =<br>
m_storage.getDictionaryFromObject(m_storage.getObjectByReference(page)))<br>
{<br>
std::vector<PDFObjectReference> annots =<br>
loader.readReferenceArrayFromDictionary(pageDictionary, "Annots");<br>
annots.erase(std::remove(annots.begin(), annots.end(),<br>
annotation), annots.end());<br>
<br>
PDFObjectFactory factory;<br>
factory.beginDictionary();<br>
factory.beginDictionaryItem("Annots");<br>
if (!annots.empty())<br>
{<br>
factory << annots;<br>
}<br>
else<br>
{<br>
factory << PDFObject();<br>
}<br>
factory.endDictionaryItem();<br>
factory.endDictionary();<br>
<br>
mergeTo(page, factory.takeObject());<br>
}<br>
<br>
setObject(annotation, PDFObject());<br>
}<br>
<br>
PDF4QT can be found here: <a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJakubMelka%2FPDF4QT&data=05%7C01%7Clrosenth%40adobe.com%7C20fe244e683442cbddc008da9d665505%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637995360231784319%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NMLVc%2Fbwtyjm0UxtXlqtIEs9eaBU%2BO%2F%2FNaCevw%2F%2Bz8E%3D&reserved=0">
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJakubMelka%2FPDF4QT&data=05%7C01%7Clrosenth%40adobe.com%7C20fe244e683442cbddc008da9d665505%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637995360231784319%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NMLVc%2Fbwtyjm0UxtXlqtIEs9eaBU%2BO%2F%2FNaCevw%2F%2Bz8E%3D&reserved=0</a><br>
<br>
What can we do to solve this? I think we should mimic how PDF4QT does<br>
it. What do you think?<o:p></o:p></span></p>
</div>
</div>
</body>
</html>