pdfium例子

Posted hshy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pdfium例子相关的知识,希望对你有一定的参考价值。

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例子的主要内容,如果未能解决你的问题,请参考以下文章

全能PDF:Pdfium.Net SDK 2023-03-18 Crack

pdfium使用

pdfium舍弃v8依赖

pdfium单元测试

pdfium ppm demo

使用 Chrome pdfium 将 HTML 转换为 PDF