Skip to main content
Participant
April 1, 2025
Question

Clipboard.SetDataObject seems not to work in Adobe Acrobat Protected Mode

  • April 1, 2025
  • 1 reply
  • 162 views
 public void CopyToClipboard()
 {
     try
     {
         Size s = tape.GetPrintSize(0);
         if ((s.Width > 0) && (s.Height > 0))
         {
             const int margin = 20;
             s.Width += margin + margin;
             s.Height += margin + margin;
             Bitmap bmp = new Bitmap(s.Width, s.Height);
             Graphics gcs = Graphics.FromImage(bmp);
             gcs.FillRectangle(Brushes.White, 0, 0, s.Width, s.Height);
             gcs.DrawRectangle(Pens.Black, 0, 0, s.Width - 1, s.Height - 1);
             tape.Print(gcs, new Point(margin, margin), 0);
             Clipboard.SetDataObject(bmp);
         }
     }
     catch (Exception)
     {
         DisplayError("Error saving image to clipboard");
     }
 }

 Issue while i am trying to copy a bmp object to clipboard from a windows form ,my code works perfectly fine in non-protected mode ,but fails in protected mode. 

1 reply

Thom Parker
Community Expert
Community Expert
April 1, 2025

Yes, this is as expected. There is very restricted access to anything on the user's local file system when Acrobat is in Protected Mode. To handle this situation you'll need to create a Broker. 

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/overview/SandboxBrokerExt.html

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often