我曾尝试使用 pdfium 在 android4.3 中生成 pdf。但我不知道如何将位图添加到 FPDF_PAGE。这是我的测试源代码:
int main(){
FPDF_InitLibrary();
FPDF_DOCUMENT pPDFDoc = FPDF_CreateNewDocument();
//insert
FPDF_PAGE pdf_page = FPDFPage_New(pPDFDoc,0,500,600);
FPDF_PAGEOBJECT object = FPDFPageObj_NewImgeObj(pPDFDoc);
//add bitmap to object.
//what should i do here????
FPDFPage_GenerateContent(pdf_page);
FPDFPage_InsertObject(pdf_page, object);
int fd = open("/sdcard/temp.pdf",O_RDWR|O_CREAT);
if (fd < 1)
{
printf("Cannot write to file descriptor. %d : Error:%d", fd,errno);
}
WritePdf(pPDFDoc,fd);
FPDF_DestroyLibrary();
return 0;
}
谢谢!!