我已经尝试过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;
}
谢谢!!
答案 0 :(得分:0)
有一个FPDFImageObj_SetBitmap可用于将FPDF_BITMAP设置为图像对象。