mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-07-16 07:59:46 +08:00
25 lines
619 B
C#
25 lines
619 B
C#
using CPF.Mac.CoreFoundation;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace CPF.Mac.CoreGraphics
|
|
{
|
|
internal static class CGPDFString
|
|
{
|
|
[DllImport("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/CoreGraphics")]
|
|
private static extern IntPtr CGPDFStringCopyTextString(IntPtr pdfStr);
|
|
|
|
public static string ToString(IntPtr pdfString)
|
|
{
|
|
if (pdfString == IntPtr.Zero)
|
|
{
|
|
return null;
|
|
}
|
|
using (CFString cFString = new CFString(CGPDFStringCopyTextString(pdfString), owns: true))
|
|
{
|
|
return cFString.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|