码迷,mamicode.com
首页 > 其他好文 > 详细

pdfium例子

时间:2020-01-13 10:35:27      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:gns   map   int   free   rom   nsf   inf   his   type   

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();

 

pdfium例子

标签:gns   map   int   free   rom   nsf   inf   his   type   

原文地址:https://www.cnblogs.com/hshy/p/12185920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!