pdfium例子

两盒软妹~` 提交于 2020-01-13 10:21:09
FPDF_InitLibrary(NULL);
    /*
     CFX_FolderFontInfo sysfont;
     CFX_FontMapper fontmap;
     CFX_Font myfont;
     IFX_SystemFontInfo *isysfont = NULL;
     IFX_FontMapper *ifontmap = NULL;

     CFX_FontMgr fontmgr;
     fontmgr.InitFTLibrary();
     fontmgr.m_pExtMapper = new CFX_FontMapper();
     fontmgr.m_pExtMapper->m_pFontMgr = &fontmgr;
     */
    FPDF_DOCUMENT outdoc;
    //    string inpdf = "/home/lyd/work/gnpdf/441.pdf";
//    outdoc = FPDF_CreateNewDocument();
    //     CPDF_Document* cpdf_doc_ = CPDFDocumentFromFPDFDocument(outdoc);
    //     const CPDF_Font* stock_font = CPDF_Font::GetStockFont(cpdf_doc_, "sysfFS"); //SimSun
    //     int type = stock_font->GetFontType();


     //    CPDF_Type3Font typefont;

    /*
    FPDF_PAGE page = FPDFPage_New(outdoc, 0, 612, 792);
    FPDF_PAGEOBJECT text_object1 = FPDFPageObj_NewTextObj(outdoc, "Arial",
            12.0f);

    std::unique_ptr<unsigned short, pdfium::FreeDeleter> text1 =
            GetFPDFWideString(L"this is yignsdfsf");
    FPDFText_SetText(text_object1, text1.get());
    //     FPDFPageObj_SetFillColor(text_object1, 0, 0, 255, 150)
    FPDFPageObj_Transform(text_object1, 1, 0, 0, 1, 200, 600);
    FPDFPage_InsertObject(page, text_object1);

    FPDFPage_GenerateContent(page);

    */
    string filename2 = "/root/me.pdf";
    int fp = open(filename2.c_str(), O_RDWR | O_CREAT);
    PdfToFdWriter writer;
    writer.version = 1;
    writer.dstFd = fp;
    writer.WriteBlock = &writeBlock;
    FPDF_SaveAsCopy(outdoc, &writer, FPDF_NO_INCREMENTAL);

    FPDF_DestroyLibrary();

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!