Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

User avatar
rakunavi
User
Posts: 1680
Joined: Sat Sep 11, 2021 5:04 am

Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

Post by rakunavi »

Hello all,

This is related to what I commented in this post, but I would like to expand on it and post it again.

Currently, there are three ways to copy an object, whether it is a comment (A) or base content (B).

  1. Copy and paste via clipboard
    • Execute "Duplicate..." command from the Selection dropdown menu on the Home Tab
      • "Duplicate Pages" command on the Organize Tab
      There are a total of six combinations (2 multiplied by 3), but only when copying and pasting comments via the clipboard, i.e., when using combination (A-1), the file size simply increases by the number of copies made. In other combinations, the original object is referenced inside the PDF and the image itself is not copied in duplicate, so the file size does not grow in proportion to the number of copies. In Acrobat, copying and pasting comments via the clipboard in the same way (i.e., case A-1) does not significantly increase the file size.

      For reference, the following is a list of output file sizes when an image is pasted as a comment (stamp) (A) or content (B) on the first page and then copied in each of the three ways shown above for a final total of 10 pages. The figure is based on a screen capture of the contents of the attached ZIP archive file when opened in Explorer.

      • figure.png
      • SampleFiles.zip
      Only in the case of (A-1), the file size is 216 KB, which is about 8 times larger than the original 26 KB. At the same time, please confirm that within the ZIP archive, the storage size has been reduced from 216 KB to 25 KB due to surprisingly efficient compression. This means that there is a considerable amount of waste in the PDF file ("A1 Comment-CopyAndPaste.pdf"). Incidentally, if you copy and paste comments via the clipboard (i.e., case A-1) with the latest version of Acrobat Reader, the output file size is 31 KB ("Reference A-1 Comment-CopyAndPaste_Acrobat.pdf"). The result is the same in the long-ago Acrobat X. This suggests that "smart" copying is performed inside Acrobat.

      The Audit Space Usage Report results for each file are also shown below for reference, and you can see that there are exactly 10 image files in the file copied by copying and pasting the comments in the PDF-XChange Editor. On the other hand, only one image file exists in the file created by the same method in Acrobat.

      • PDFXCE.png

        ACROBAT.png
      I used an image file in the verification, but as you can see in the post that triggered this post, the same results are obtained when the file attachment icon is copied.

      The "Duplicate..." command from the Selection dropdown menu allows you to copy without creating unnecessary duplicate images, but this operation is more specific than copy and paste, and specifying the page to paste to is also cumbersome. Ideally, the size of the output file should not be significantly different regardless of which method is used to copy it.

      Note that even with the Optimize PDF feature, it was not possible to remove the useless parts of this duplicate image file. Even if the Optimize PDF feature could clean up the duplicates, it would still be inferior to the smart copy-and-paste method in Acrobat, so there seems to be some room for improvement in PDF-XChange Editor.

      • Optimize.png
      I hope someday we will be able to do "smart" copy and paste without having to think about all the details behind the scenes.

      Hoping that the above information will be of some help to you.
      Thank you so much for your continued support.

      Best regards,
      rakunavi

      - PDF-XChange Editor Plus Version: 10.1.1 build 381
      - OS Version: Windows 11 Home 22H2 Build 22621.2283
      - PC Model: Lenovo IdeaPad C340-15IWL, HP All-in-One 22-c0xx
      You do not have the required permissions to view the files attached to this post.
      TOP desires for PDFXCE
      forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
      forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
      forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
      forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
      User avatar
      Daniel - PDF-XChange
      Site Admin
      Posts: 11052
      Joined: Wed Jan 03, 2018 6:52 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Daniel - PDF-XChange »

      Hello, rakunavi

      Thank you for the detailed breakdown, The Dev team has agreed to look into this possibility when the Dev team lead is back from his vacation. For the moment I cannot promise implementation, but I do have a ticket number for consideration:

      #6634: Copy/paste comments without size increase.

      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
      User avatar
      David.P
      User
      Posts: 1638
      Joined: Thu Feb 28, 2008 8:16 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by David.P »

      Hello all,

      I agree that it would be ideal if comment images (bitmaps) were saved just once in a PDF file, irrespective of how many times they're duplicated.

      For bitmap images that are part of the base content, this is already how it works. This feature is incredibly useful. For instance, if you have a high-resolution explanatory image, you can duplicate it across as many pages of your file as you like. Despite its numerous appearances, the image only consumes the storage space of its initial copy.

      So yes, +1 for this feature request!

      Also, I believe that comment images (bitmaps) are not optimized, or re-compressed, respectively, when a PDF file is saved as optimized, or when images of a PDF file are re-compressed via the respective menu command. This also could be improved in my view.

      Best regards
      David.P
      :)
      David.P
      PDF-XChange Pro
      User avatar
      Daniel - PDF-XChange
      Site Admin
      Posts: 11052
      Joined: Wed Jan 03, 2018 6:52 pm

      Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Daniel - PDF-XChange »

      :)
      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
      Arnold
      User
      Posts: 874
      Joined: Tue Jun 09, 2009 3:53 am

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Arnold »

      +1
      User avatar
      rakunavi
      User
      Posts: 1680
      Joined: Sat Sep 11, 2021 5:04 am

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by rakunavi »

      Hello all,

      @Daniel
      • Thank you, Daniel, for creating the ticket!
        rakunavi wrote: Fri Sep 29, 2023 12:48 am Currently, there are three ways to copy an object, whether it is a comment (A) or base content (B).

        1. Copy and paste via clipboard
        2. Execute "Duplicate..." command from the Selection dropdown menu on the Home Tab
        3. "Duplicate Pages" command on the Organize Tab
        In the case of stamps, you can achieve the same goal as the above three methods by registering stamps in the Stamp palette in advance and then adding them from the Stamps menu. Interestingly, no matter how many times you add a stamp, as long as it is before you save the file, it will not waste storage space. In other words, they are added "smartly" as described above.

        In this respect, PDF-XChange Editor is superior to Acrobat. In Acrobat, stamps added from the stamp menu are always duplicated in an un-smart way, wasting storage space, whether before or after the file is saved. However, even in PDF-XChange Editor, if you save the file, reopen it, and add a stamp from the Stamps menu, a new duplicate will be created at that time.

        Since a menu dedicated to stamps is deliberately prepared, it is generally assumed that users add stamps from the stamp menu each time. However, considering the behavior described above, if it is clear that a large number of the same stamps will be added continuously to a single document, it may be better to add the stamps to specific pages in advance, such as the first or last page, and then copy them from there to other pages to save file size. This would be true for both PDF-XChange Editor and Acrobat.

        Other than image files, the components of a stamp with a large file size are embedded subset fonts. Note that casually adding a stamp containing these objects from the stamp menu can result in considerable waste in the file unintentionally.

        Feature Request
        The following figure shows the timing of storage space consumption when added from the stamp menu, the top two are the current behavior of Acrobat and PDF-XChange Editor. As noted above, Acrobat consumes storage space whenever a stamp is added, but PDF-XChange Editor does not consume storage space until the file is saved, as indicated by the yellow stamp symbol. Therefore, I suggest that the session information be extended to include the information necessary to avoid wasting storage space when adding stamps from the stamp menu.

        • figure.png
        As mentioned above, PDF-XChange Editor already has an advantage over Acrobat at this point, but there might be value in getting an even greater advantage. This is because these technical particularity, even if it is a very trivial feature, could be a reason for people to choose PDF-XChange Editor over Acrobat.

        Of course, the smart copy-and-paste mentioned earlier is top priority. However, I know this is asking for the impossible, but could you please consider this feature request as well?
      @David.P, @Arnold
      • Thank you for expressing your support. I hope that all your voice will reach the Development Leader.
      Best regards,
      rakunavi
      You do not have the required permissions to view the files attached to this post.
      TOP desires for PDFXCE
      forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
      forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
      forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
      forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
      User avatar
      Stefan - PDF-XChange
      Site Admin
      Posts: 19870
      Joined: Mon Jan 12, 2009 8:07 am

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Stefan - PDF-XChange »

      Hello rakunavi, David P., Arnold, and all,

      Many thanks for the great contributions to the topic.
      You can be sure that all the comments do reach the dev team, so when they start working on a ticket - all is taken into consideration.

      We will be working on the ticket as time allows - and for the time being, as discovered earlier in this topic - please use the "Duplicate" tool when you have to create many copies of the same object to minimize the file size of the finished document.

      Kind regards,
      Stefan
      User avatar
      David.P
      User
      Posts: 1638
      Joined: Thu Feb 28, 2008 8:16 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by David.P »

      Hello all,

      It seems that there already have been some improvements in the meantime with respect to this feature request.

      For example, when duplicating a comment, particularly a stamp comment that contains a bitmap, the PDF file size is not increased anymore as it used to be the case.

      However, currently this only works when the stamp is duplicated by CTRL-dragging it (Case A), even if it is CTRL-dragged to another page.

      On the other hand (Case B), if a comment stamp is copied to the clipboard and pasted to the same or to another page, this still increases the file size every time the stamp is pasted.

      So (Case B) if we paste the same stamp 10 times on the same or to another page and it is a 1MB bitmap, our PDF size will increase by 10MB.

      However (Case A), if we duplicate the stamp 10 times by CTRL-dragging it, our PDF size will not increase.

      Maybe the Devs can have another look into this in order for Case B to also not increase the file size. That would be perfect.

      Best regards,

      David.P
      David.P
      PDF-XChange Pro
      User avatar
      Stefan - PDF-XChange
      Site Admin
      Posts: 19870
      Joined: Mon Jan 12, 2009 8:07 am

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Stefan - PDF-XChange »

      Hello David.P,

      I will ask them to take a look. I suspect that the different ways of copying the original stamp mean that the copy has to be recorded in a different way in the PDF structure, but if it can be made so that your case B also does not increase the size as dramatically - I am sure this will be something the devs would like to look at!

      Kind regards,
      Stefan
      User avatar
      David.P
      User
      Posts: 1638
      Joined: Thu Feb 28, 2008 8:16 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by David.P »

      That's awesome, thank you Stefan.

      I forgot to mention that duplicating a base content bitmap does not increase the PDF file size (by more than a few bytes) under any circumstances, i.e. including when copying and pasting.

      This is of course fantastic, because this way, you can have a multi-megabyte high-resolution bitmap appearing on hundreds of pages of your PDF (even in different size, rotation, place...) -- and it will only be saved once into the PDF.

      If the same could be fully achieved also with bitmap stamps (i.e., on the comment layer), that would be perfect.

      Best Regards
      David
      Last edited by David.P on Tue Apr 01, 2025 12:53 pm, edited 1 time in total.
      David.P
      PDF-XChange Pro
      User avatar
      PHK
      User
      Posts: 1400
      Joined: Tue Nov 24, 2020 4:02 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by PHK »

      @David.P: Speaking as a lay-user only, it seems to me that in your Case A, you are not really 'copying,' or duplicating, the object but rather just redefining its location (either on the same page or somewhere else) of the object. Whereas in Case B, you are truly duplicatiing, i.e., creating another object with all of the surrounding code that makes it a discrete object that can be placed anywhere and leaving the original object as it was. That, of course, consumes more memory. In other words, in Case A one is not really 'copying' the object in the ordinary sense of the word but rather preparing it for moveability for which a simple single word does not seem to exist in the English language.
      Last edited by PHK on Tue Apr 01, 2025 12:53 pm, edited 1 time in total.
      All best,

      FringePhil
      User avatar
      Stefan - PDF-XChange
      Site Admin
      Posts: 19870
      Joined: Mon Jan 12, 2009 8:07 am

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Stefan - PDF-XChange »

      Hello David.P,

      The way this is done is having one "resource" for the bitmap stored in the PDF structure and then referencing it multiple times on different places in the document. So the "bulk" of the info is only present once in the file, and the few bytes extra are to indicate that a new instance of the same should be shown on page z at coordinates (x,y). And it seems like the same is done when you Crtl + Drag annotation copies but not when Ctrl + C - Ctrl + V copy-pasting them.

      Kind regards,
      Stefan
      User avatar
      David.P
      User
      Posts: 1638
      Joined: Thu Feb 28, 2008 8:16 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by David.P »

      Right Phil, fully correct from a language point of view -- it's not the object itself that's being copied; rather, only its visual representation is being duplicated.

      Note however that the desired behavior is already fully there for base content, no matter how you duplicate it.

      Exactly Stefan, that's how the current behavior can be explained!
      David.P
      PDF-XChange Pro
      User avatar
      PHK
      User
      Posts: 1400
      Joined: Tue Nov 24, 2020 4:02 pm

      Re: Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by PHK »

      David.P wrote: Tue Apr 01, 2025 12:56 pm ...
      Note however that the desired behavior is already fully there for base content, no matter how you duplicate it.
      ...
      Right, David. It is important to point that out.
      All best,

      FringePhil
      User avatar
      Stefan - PDF-XChange
      Site Admin
      Posts: 19870
      Joined: Mon Jan 12, 2009 8:07 am

      Copying and pasting comments via clipboard increases file size in proportion to the number of times they are copied

      Post by Stefan - PDF-XChange »

      Hi All,

      It seems like we already have a ticket for this:
      #6634: Copy/paste comments without size increase.

      We will update this topic when there are any news in the ticket as well.

      Cheers,
      Stefan