<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>pdf annotation removal on Document Processing REST APIs | GroupDocs Cloud</title>
    <link>https://blog-qa.groupdocs.cloud/vi/tag/pdf-annotation-removal/</link>
    <description>Recent content in pdf annotation removal on Document Processing REST APIs | GroupDocs Cloud</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>vi</language>
    <lastBuildDate>Wed, 21 Oct 2026 13:18:44 +0000</lastBuildDate><atom:link href="https://blog-qa.groupdocs.cloud/vi/tag/pdf-annotation-removal/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Xóa các đối tượng chú thích khỏi PDF bằng REST trong Node.JS</title>
      <link>https://blog-qa.groupdocs.cloud/vi/annotation/remove-annotation-objects-from-pdf-with-rest-in-nodejs/</link>
      <pubDate>Wed, 21 Oct 2026 13:18:44 +0000</pubDate>
      
      <guid>https://blog-qa.groupdocs.cloud/vi/annotation/remove-annotation-objects-from-pdf-with-rest-in-nodejs/</guid>
      <description>Tìm hiểu cách xóa các đối tượng Annotation khỏi PDF bằng REST trong Node.JS sử dụng GroupDocs.Annotation Cloud SDK. Hướng dẫn từng bước với mã, cURL và các thực tiễn.</description>
      <content:encoded><![CDATA[<p>Việc loại bỏ các ghi chú, đánh dấu, hoặc dấu mực không mong muốn khỏi PDF là một yêu cầu thường gặp khi chuẩn bị tài liệu sạch để phân phối. <a href="https://products.groupdocs.cloud/annotation/nodejs/">GroupDocs.Annotation Cloud SDK for Node.js</a> cung cấp một thư viện dựa trên REST mạnh mẽ cho phép bạn quản lý các chú thích <a href="https://docs.fileformat.com/pdf">PDF</a> một cách lập trình. Hướng dẫn này sẽ chỉ cho bạn cách xóa các đối tượng Annotation khỏi PDF bằng REST trong Node.JS, từng bước một. Bạn sẽ thấy một ví dụ mã hoàn chỉnh, các lệnh cURL tương đương, mẹo cấu hình, và các khuyến nghị thực tiễn tốt nhất để tích hợp việc xóa chú thích vào dịch vụ của mình.</p>
<h2 id="ví-dụ-hoạt-động-đầy-đủ-để-xóa-các-đối-tượng-ghi-chú-khỏi-pdf-bằng-rest-trong-nodejs">Ví dụ Hoạt động đầy đủ để Xóa các Đối tượng Ghi chú khỏi PDF bằng REST trong Node.JS</h2>
<p>Ví dụ này minh họa cách tải lên một tệp PDF, xóa tất cả các chú thích của nó và tải xuống tệp đã được làm sạch bằng GroupDocs.Annotation SDK.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fs</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;fs&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">path</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;path&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#34;@groupdocs/annotation-cloud&#34;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// ==== Authentication =========================================================
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">clientId</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_ID&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">clientSecret</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_SECRET&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">config</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">Configuration</span>(<span style="color:#a6e22e">clientId</span>, <span style="color:#a6e22e">clientSecret</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">annotationsApi</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">AnnotationsApi</span>(<span style="color:#a6e22e">config</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">storageApi</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">StorageApi</span>(<span style="color:#a6e22e">config</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// ==== Local &amp; Remote file definitions =======================================
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">localInputPath</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">path</span>.<span style="color:#a6e22e">resolve</span>(<span style="color:#a6e22e">__dirname</span>, <span style="color:#e6db74">&#34;input.pdf&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">localOutputPath</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">path</span>.<span style="color:#a6e22e">resolve</span>(<span style="color:#a6e22e">__dirname</span>, <span style="color:#e6db74">&#34;output.pdf&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">remoteFilePath</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;input.pdf&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// ==== Main workflow ==========================================================
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>(<span style="color:#66d9ef">async</span> () =&gt; {
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// 1. Upload PDF to GroupDocs Cloud storage
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fileBytes</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">fs</span>.<span style="color:#a6e22e">readFileSync</span>(<span style="color:#a6e22e">localInputPath</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">uploadRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">UploadFileRequest</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">path</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">remoteFilePath</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">file</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileBytes</span>
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">storageApi</span>.<span style="color:#a6e22e">uploadFile</span>(<span style="color:#a6e22e">uploadRequest</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// 2. Build FileInfo object for the uploaded PDF
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fileInfo</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">FileInfo</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">filePath</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">remoteFilePath</span>
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// 3. Retrieve all existing annotations
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">getAnnotationsRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">GetAnnotationsRequest</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileInfo</span>
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">annotationsResult</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">annotationsApi</span>.<span style="color:#a6e22e">getAnnotations</span>(<span style="color:#a6e22e">getAnnotationsRequest</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">annotationIds</span> <span style="color:#f92672">=</span> (<span style="color:#a6e22e">annotationsResult</span>.<span style="color:#a6e22e">annotations</span> <span style="color:#f92672">||</span> []).<span style="color:#a6e22e">map</span>(<span style="color:#a6e22e">a</span> =&gt; <span style="color:#a6e22e">a</span>.<span style="color:#a6e22e">id</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// 4. Delete all annotations (if any)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">annotationIds</span>.<span style="color:#a6e22e">length</span> <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">0</span>) {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">deleteRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">DeleteAnnotationsRequest</span>({
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileInfo</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">annotationIds</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">annotationIds</span>
</span></span><span style="display:flex;"><span>        });
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">annotationsApi</span>.<span style="color:#a6e22e">deleteAnnotations</span>(<span style="color:#a6e22e">deleteRequest</span>);
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// 5. Download the cleaned PDF back to local storage
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">downloadRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">DownloadFileRequest</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">path</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">remoteFilePath</span>
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fileStream</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">storageApi</span>.<span style="color:#a6e22e">downloadFile</span>(<span style="color:#a6e22e">downloadRequest</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">fs</span>.<span style="color:#a6e22e">writeFileSync</span>(<span style="color:#a6e22e">localOutputPath</span>, <span style="color:#a6e22e">fileStream</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">`All annotations removed. Clean file saved to </span><span style="color:#e6db74">${</span><span style="color:#a6e22e">localOutputPath</span><span style="color:#e6db74">}</span><span style="color:#e6db74">`</span>);
</span></span><span style="display:flex;"><span>})();
</span></span></code></pre></div><blockquote>
<p><strong>Lưu ý:</strong> Ví dụ mã này minh họa chức năng cốt lõi. Trước khi sử dụng trong dự án của bạn, hãy chắc chắn cập nhật mọi đường dẫn tệp và giá trị cấu hình để phù hợp với môi trường thực tế của bạn, xác minh rằng tất cả các phụ thuộc cần thiết đã được cài đặt đúng cách, và kiểm tra kỹ lưỡng trong môi trường phát triển. Nếu bạn gặp bất kỳ vấn đề nào, vui lòng tham khảo <a href="https://docs.groupdocs.cloud/annotation/">tài liệu chính thức</a> hoặc liên hệ với <a href="https://forum.groupdocs.cloud/c/annotation/10">đội hỗ trợ</a> để được trợ giúp.</p>
</blockquote>
<h2 id="xóa-chú-thích-pdf-qua-rest-api-bằng-curl">Xóa chú thích PDF qua REST API bằng cURL</h2>
<p>Dưới đây là các lệnh cURL thực hiện cùng quy trình xóa chú thích thông qua các endpoint REST của GroupDocs.Annotation Cloud.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 1. Obtain an access token</span>
</span></span><span style="display:flex;"><span>curl -X POST <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/auth/token&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -d <span style="color:#e6db74">&#34;{\&#34;client_id\&#34;:\&#34;YOUR_CLIENT_ID\&#34;,\&#34;client_secret\&#34;:\&#34;YOUR_CLIENT_SECRET\&#34;}&#34;</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 2. Upload the source PDF</span>
</span></span><span style="display:flex;"><span>curl -X PUT <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/storage/file/input.pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     --data-binary <span style="color:#e6db74">&#34;@input.pdf&#34;</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 3. Retrieve annotation IDs</span>
</span></span><span style="display:flex;"><span>curl -X GET <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/annotation/annotations?filePath=input.pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 4. Delete all retrieved annotations</span>
</span></span><span style="display:flex;"><span>curl -X DELETE <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/annotation/annotations?filePath=input.pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -d <span style="color:#e6db74">&#34;{\&#34;annotationIds\&#34;:[\&#34;id1\&#34;,\&#34;id2\&#34;]}&#34;</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 5. Download the cleaned PDF</span>
</span></span><span style="display:flex;"><span>curl -X GET <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/storage/file/input.pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -o output.pdf
</span></span></code></pre></div><p>Để xem danh sách đầy đủ các endpoint và tham số, hãy xem <a href="https://reference.groupdocs.cloud/annotation/">tài liệu API chính thức</a>.</p>
<h2 id="cách-xóa-đối-tượng-ghi-chú-trong-pdf-bằng-rest-trong-nodejs-hoạt-động">Cách Xóa Đối Tượng Ghi Chú trong PDF bằng REST trong Node.JS Hoạt Động</h2>
<ol>
<li><strong>Cấu hình xác thực</strong> - Lớp <code>Configuration</code> được khởi tạo với <code>clientId</code> và <code>clientSecret</code> của bạn, tạo ra một ngữ cảnh đã xác thực cho tất cả các cuộc gọi API tiếp theo.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">config</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">Configuration</span>(<span style="color:#a6e22e">clientId</span>, <span style="color:#a6e22e">clientSecret</span>);
</span></span></code></pre></div><ol start="2">
<li><strong>Tải lên tệp</strong> - <code>UploadFileRequest</code> gửi các byte PDF cục bộ tới lưu trữ GroupDocs Cloud. Phương thức <code>storageApi.uploadFile</code> xử lý việc truyền tải.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">uploadRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">UploadFileRequest</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">path</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">remoteFilePath</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">file</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileBytes</span>
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">await</span> <span style="color:#a6e22e">storageApi</span>.<span style="color:#a6e22e">uploadFile</span>(<span style="color:#a6e22e">uploadRequest</span>);
</span></span></code></pre></div><ol start="3">
<li><strong>Lấy chú thích</strong> - <code>GetAnnotationsRequest</code> tạo một đối tượng yêu cầu với tham chiếu <code>FileInfo</code>. Lệnh <code>annotationsApi.getAnnotations</code> trả về một bộ sưu tập các đối tượng chú thích, từ đó trích xuất các ID.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">getAnnotationsRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">GetAnnotationsRequest</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileInfo</span>
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">annotationsResult</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">annotationsApi</span>.<span style="color:#a6e22e">getAnnotations</span>(<span style="color:#a6e22e">getAnnotationsRequest</span>);
</span></span></code></pre></div><ol start="4">
<li><strong>Xóa chú thích</strong> - Nếu có bất kỳ ID nào, <code>DeleteAnnotationsRequest</code> được điền và truyền cho <code>annotationsApi.deleteAnnotations</code>, lệnh này sẽ xóa vĩnh viễn các chú thích khỏi PDF đã lưu.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">deleteRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">DeleteAnnotationsRequest</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">fileInfo</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">annotationIds</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">annotationIds</span>
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">await</span> <span style="color:#a6e22e">annotationsApi</span>.<span style="color:#a6e22e">deleteAnnotations</span>(<span style="color:#a6e22e">deleteRequest</span>);
</span></span></code></pre></div><ol start="5">
<li><strong>Tải xuống PDF sạch</strong> - Cuối cùng, <code>DownloadFileRequest</code> lấy tệp đã cập nhật, và <code>fs.writeFileSync</code> ghi nó vào hệ thống tệp cục bộ.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">downloadRequest</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">DownloadFileRequest</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">path</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">remoteFilePath</span>
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fileStream</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">storageApi</span>.<span style="color:#a6e22e">downloadFile</span>(<span style="color:#a6e22e">downloadRequest</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">fs</span>.<span style="color:#a6e22e">writeFileSync</span>(<span style="color:#a6e22e">localOutputPath</span>, <span style="color:#a6e22e">fileStream</span>);
</span></span></code></pre></div><p>Để xem chi tiết các định nghĩa lớp và phương thức, hãy tham khảo <a href="https://reference.groupdocs.cloud/annotation/">Tham khảo API</a>.</p>
<h2 id="cài-đặt-và-cấu-hình-groupdocsannotation-cloud-sdk-for-nodejs">Cài đặt và cấu hình GroupDocs.Annotation Cloud SDK for Node.js</h2>
<p>SDK được phân phối dưới dạng gói npm. Cài đặt nó bằng lệnh dưới đây và sau đó yêu cầu nó trong dự án của bạn.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npm install groupdocs-annotation-cloud
</span></span></code></pre></div><p>Bạn cũng có thể tải xuống gói mới nhất trực tiếp từ <a href="https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-node">trang phát hành trên GitHub</a> hoặc từ <a href="https://releases.groupdocs.cloud/annotation/nodejs/">URL tải xuống chính thức</a>.</p>
<p>Sau khi cài đặt, nhập thư viện và tạo một đối tượng cấu hình như được hiển thị trong ví dụ mã sau:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#34;@groupdocs/annotation-cloud&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">config</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsAnnotationCloud</span>.<span style="color:#a6e22e">Configuration</span>(<span style="color:#e6db74">&#34;YOUR_CLIENT_ID&#34;</span>, <span style="color:#e6db74">&#34;YOUR_CLIENT_SECRET&#34;</span>);
</span></span></code></pre></div><p>Đảm bảo môi trường chạy của bạn đáp ứng các yêu cầu về phiên bản Node.js và bạn có tài khoản GroupDocs hợp lệ để lấy thông tin xác thực client.</p>
<h2 id="tùy-chọn-và-cài-đặt-loại-bỏ-chú-thích">Tùy chọn và Cài đặt Loại bỏ chú thích</h2>
<p>SDK cung cấp một số tham số mà bạn có thể điều chỉnh:</p>
<ul>
<li><strong>clientId / clientSecret</strong> - Thông tin xác thực cho OAuth. Đặt chúng trong hàm khởi tạo <code>Configuration</code>.</li>
<li><strong>fileInfo.filePath</strong> - Đường dẫn tới tệp PDF trong lưu trữ GroupDocs Cloud. Điều chỉnh nếu bạn lưu tệp trong thư mục khác.</li>
<li><strong>annotationIds</strong> - Một mảng các ID được trả về bởi <code>GetAnnotations</code>. Cung cấp một phần con cho phép xóa có chọn lọc.</li>
</ul>
<p>Các cài đặt bổ sung như thời gian chờ yêu cầu và cấu hình proxy có sẵn trong tài liệu SDK; xem <a href="https://docs.groupdocs.cloud/annotation/">tài liệu chính thức</a> để biết danh sách đầy đủ.</p>
<h2 id="các-thực-tiễn-tốt-nhất-cho-việc-xóa-chú-thích-pdf-qua-rest">Các thực tiễn tốt nhất cho việc xóa chú thích PDF qua REST</h2>
<ul>
<li><strong>Xác thực ID chú thích</strong> - Luôn kiểm tra xem các ID bạn dự định xóa có tồn tại hay không; việc cố gắng xóa các ID không tồn tại có thể gây ra lỗi 404.</li>
<li><strong>Sử dụng HTTPS</strong> - Tất cả các cuộc gọi API phải được thực hiện qua HTTPS để bảo vệ thông tin đăng nhập và dữ liệu tài liệu của bạn.</li>
<li><strong>Xử lý tệp lớn với tải lên dạng khối</strong> - Đối với các tệp PDF lớn hơn 100 MB, nên sử dụng endpoint tải lên đa phần để tránh thời gian chờ.</li>
<li><strong>Ghi lại phản hồi API</strong> - Lưu trữ ID yêu cầu và phản hồi để tạo nhật ký kiểm toán và dễ dàng khắc phục sự cố.</li>
<li><strong>Tái sử dụng token truy cập</strong> - Lưu token OAuth trong bộ nhớ đệm cho đến khi hết hạn để giảm tải xác thực.</li>
</ul>
<h2 id="câu-hỏi-thường-gặp">Câu hỏi thường gặp</h2>
<ul>
<li>
<p><strong>How do I authenticate with GroupDocs.Annotation Cloud API?</strong><br>
Lấy client ID và secret từ tài khoản GroupDocs của bạn, sau đó yêu cầu một access token thông qua endpoint OAuth. Xem <a href="https://docs.groupdocs.cloud/annotation/">tài liệu chính thức</a> để biết chi tiết.</p>
</li>
<li>
<p><strong>Tôi có thể xóa các chú thích cụ thể thay vì tất cả không?</strong><br>
Có, hãy cung cấp các ID của các chú thích bạn muốn xóa trong DeleteAnnotationsRequest. SDK trả về danh sách các ID chú thích sau một cuộc gọi GetAnnotations.</p>
</li>
<li>
<p><strong>Làm thế nào để tôi xóa các đối tượng Annotation khỏi PDF bằng REST trong Node.JS?</strong><br>
Sử dụng GroupDocs.Annotation Cloud SDK for Node.js để gọi endpoint DeleteAnnotations sau khi lấy các ID của annotation. Quy trình đầy đủ được trình bày trong ví dụ mã và phần cURL của hướng dẫn này.</p>
</li>
<li>
<p><strong>Cần giấy phép gì cho việc sử dụng trong môi trường sản xuất?</strong><br>
Cần một giấy phép trả phí cho môi trường sản xuất. Bạn có thể nhận giấy phép tạm thời từ <a href="https://purchase.groupdocs.cloud/temporary-license/">trang giấy phép tạm thời</a> trong quá trình đánh giá.</p>
</li>
</ul>
<h2 id="đọc-thêm">Đọc thêm</h2>
<ul>
<li><a href="https://blog.groupdocs.cloud/vi/annotation/extract-or-remove-annotations-from-pdf-using-rest-api-in-node-js/">Trích xuất hoặc Xóa chú thích khỏi PDF bằng REST API trong Node.js</a></li>
<li><a href="https://blog.groupdocs.cloud/vi/annotation/strikethrough-text-in-a-pdf-using-nodejs/">Gạch ngang văn bản trong PDF với Node.js và REST API</a></li>
<li><a href="https://blog.groupdocs.cloud/vi/annotation/remove-annotations-from-pdf-using-rest-api-in-python/">Xóa chú thích khỏi PDF bằng REST API trong Python</a></li>
</ul>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
