pdfPage.CopyToClipboard doesnot return the copied data when trying to access with Clipboard.GetImage
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]
