PDFiumCore icon indicating copy to clipboard operation
PDFiumCore copied to clipboard

fpdf_annot.FPDFAnnotGetFormFieldName needs a ref uint for the buffer?

Open enny1170 opened this issue 9 months ago • 2 comments

I'm try to get this method to work, but i don't find out how to use this. Other functions like fpdf_doc.FPDFBookmarkGetTitle use IntPtr as pointer to the buffer. Can someone show me how to use them correctly or is this a bug ?

enny1170 avatar Mar 11 '25 20:03 enny1170

byte[] bufferfont = new byte[1000];
fixed (byte* ptrint = bufferfont)
{
    int flags = 0; 
    uint fontnamelength = fpdf_text.FPDFTextGetFontInfo(textpage, 0, (nint)ptrint, (uint)bufferfont.Length, ref flags);
    byte[] temp = new byte[fontnamelength - 1];
    for (int i = 0; i < (int)fontnamelength - 1; i++)
    {
        temp[i] = bufferfont[i];
    }
    string name = Encoding.ASCII.GetString(temp);
}

like this

Charltsing avatar Apr 08 '25 14:04 Charltsing

Thank you. I'll see about adding some helper classes that include some of these common methods.

DJGosnell avatar Apr 08 '25 15:04 DJGosnell