user6527657
user6527657

Reputation: 1

how to create a pdf document with bitmap use pdfium?

I have tried pdfium to produce pdf in android4.3. But i have not any idea about how to add bitmap to FPDF_PAGE. This is my test source code:

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;
}

Thank you!!

Upvotes: 0

Views: 1408

Answers (1)

dj2
dj2

Reputation: 9598

There is a FPDFImageObj_SetBitmap which can be used to set a FPDF_BITMAP into an image object.

Upvotes: 0

Related Questions