Question
c# acrobat pdf convert to Image (export Image)
Hi
I want to extarct image using acrobat sdk.(Single page pdf to image)
I found the code and test that.
My problem is I don't know the size (mm) of the document.
Code is
string fileName = "C:/.../.../test.pdf";
Acrobat.AcroPDDoc pdfDoc = new Acrobat.AcroPDDoc();
bool ret = pdfDoc.Open(fileName);
if (ret == false)
{
throw new FileNotFoundException();
}
int totalPage = pdfDoc.GetNumPages();
int currentPage = 0;
Acrobat.AcroPDPage pdfPage =
(Acrobat.AcroPDPage)pdfDoc.AcquirePage(currentPage);
Acrobat.AcroPoint pdfSize = (Acrobat.AcroPoint)pdfPage.GetSize();
Acrobat.AcroRect pdfRect = new Acrobat.AcroRect();
pdfRect.Left = 0;
pdfRect.right = pdfSize.x ;
pdfRect.Top = 0;
pdfRect.bottom = pdfSize.y;
MessageBox.Show(Convert.ToString( pdfSize.x) + Convert.ToString( pdfSize.y) );
pdfPage.CopyToClipboard(pdfRect, 0, 0, 100);
IDataObject clipboardData = Clipboard.GetDataObject();
Console.WriteLine(Convert.ToChar ( clipboardData));
if (clipboardData.GetDataPresent(DataFormats.Bitmap))
{
Bitmap pdfBitmap = (Bitmap)clipboardData.GetData(DataFormats.Bitmap);
pdfBitmap.Save("C:/.../.../.bmp");
}
then Message Box show pixels of x,y . And DPI(dot per inches) is changed.
I want to extract it to the actual size of the document. Or Is there DPI function in interop.Acrobat?
