Skip to main content
Participant
February 10, 2022
Question

pdfPage.CopyToClipboard doesnot return the copied data when trying to access with Clipboard.GetImage

  • February 10, 2022
  • 1 reply
  • 778 views

I had been using this function for more than a year now and this Clipboard.GetImage is returning null for me since one month.This is only for me and none of my teammates has this issue.We are using the same version as well.

Clipboard.SetImage(m) returns the image when I use Clipboard.GetImage().     

Please find the sample code below.

 

private void button1_Click(object sender, EventArgs e)

        {

            string sourceFileName = @"F:\Anu\orders\HAT7ucrBpMPDF\documents\Azure Stmts.pdf";

            string DestinationPath = @"F:\Anu\";

            //Image act = null;

            Image img = Image.FromFile(@"C:\Users\Anu\source\repos\Metafile Sample\Images\sample.png");

            //Clipboard.SetImage(m);

            //act = Clipboard.GetImage();

            ImageFormat imageFormat = new ImageFormat(Guid.Empty);

            imageFormat = ImageFormat.Png;

            if (pdfDoc.Open(sourceFileName))

            {

                pdfPage = (Acrobat.CAcroPDPage)pdfDoc.AcquirePage(0);

                pdfPoint = (Acrobat.AcroPoint)pdfPage.GetSize();

                pdfRect.Left = 0;

                pdfRect.right = pdfPoint.x;

                pdfRect.Top = 0;

                pdfRect.bottom = pdfPoint.y;

                pdfPage.CopyToClipboard(pdfRect, 0, 0, 100);

                //Clipboard.SetImage(img);

                string outimg = "";

                string filename = Path.GetFileNameWithoutExtension(sourceFileName);

                outimg = DestinationPath + "\\" + filename + "." + imageFormat.ToString();

                Clipboard.GetImage().Save(outimg, imageFormat);

                Dispose();

            }

        }

 

[Question moved to the Acrobat SDK forum]

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
February 16, 2022

Hi,

 

Can I check the simple information first?

- Which version of Acrobat are you running?

- Which OS are you using?

Participant
February 16, 2022

OS is Windows Server 2019.

Not sure what has changed once the adobe was reinstalled.

It was perfectly working fine for me sometime back.

I checked with my colleagues, all of us are working on the same code version but they are not having any issue.