Exemplo n.º 1
0
void EmbedderTest::SetUp() {
  v8::V8::InitializeICU();

  platform_ = v8::platform::CreateDefaultPlatform();
  v8::V8::InitializePlatform(platform_);
  v8::V8::Initialize();

  // By enabling predictable mode, V8 won't post any background tasks.
  const char predictable_flag[] = "--predictable";
  v8::V8::SetFlagsFromString(predictable_flag,
                             static_cast<int>(strlen(predictable_flag)));

#ifdef V8_USE_EXTERNAL_STARTUP_DATA
  ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_));
  ASSERT_TRUE(GetExternalData(g_exe_path_, "snapshot_blob.bin", &snapshot_));
  v8::V8::SetNativesDataBlob(&natives_);
  v8::V8::SetSnapshotDataBlob(&snapshot_);
#endif  // V8_USE_EXTERNAL_STARTUP_DATA

  FPDF_InitLibrary();

  UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(this);
  memset(info, 0, sizeof(UNSUPPORT_INFO));
  info->version = 1;
  info->FSDK_UnSupport_Handler = UnsupportedHandlerTrampoline;
  FSDK_SetUnSpObjProcessHandler(info);
}
static void initializeLibraryIfNeeded() {
    Mutex::Autolock _l(sLock);
    if (sUnmatchedInitRequestCount == 0) {
        FPDF_InitLibrary();
    }
    sUnmatchedInitRequestCount++;
}
Exemplo n.º 3
0
pdfshow::pdfshow(QWidget *parent)
    : QWidget(parent)
{
	//get instance of current program (self)
    HINSTANCE hInst= GetModuleHandle (0);
	FPDF_InitLibrary(hInst);
	setAttribute(Qt::WA_PaintOnScreen,true);

	// 首先,加载文档(没有指定的密码)
	pdf_doc = FPDF_LoadDocument("./manual/usermanual.pdf", NULL);
	if (pdf_doc == NULL)// error handling
	{
		printf("加载pdf文档错误\n");
	}

	// 现在加载首页(页面索引为0)
	pdf_page = FPDF_LoadPage(pdf_doc, 0);
	iPageNum = FPDF_GetPageCount(pdf_doc);

	if (pdf_page == NULL)
	{
		printf("加载pdf页面错误\n");
	}

	page_width = FPDF_GetPageWidth(pdf_page);
	page_height = FPDF_GetPageHeight(pdf_page);
	FPDF_ClosePage(pdf_page);
}
Exemplo n.º 4
0
void Init_pdfium_ruby (void) {
  // Initialize PDFium
  FPDF_InitLibrary();
  
  // Define `PDFShaver` module as a namespace for all of our other objects
  rb_define_module("PDFShaver");
  
  // Define `Document` and `Page` classes
  Define_Document();
  Define_Page();
  //Define_PageSet();
}
Exemplo n.º 5
0
void EmbedderTest::SetUp() {
    v8::V8::InitializeICU();

#ifdef V8_USE_EXTERNAL_STARTUP_DATA
    ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_));
    ASSERT_TRUE(GetExternalData(g_exe_path_, "snapshot_blob.bin", &snapshot_));
    v8::V8::SetNativesDataBlob(&natives_);
    v8::V8::SetSnapshotDataBlob(&snapshot_);
#endif  // V8_USE_EXTERNAL_STARTUP_DATA

    FPDF_InitLibrary();

    UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(this);
    memset(info, 0, sizeof(UNSUPPORT_INFO));
    info->version = 1;
    info->FSDK_UnSupport_Handler = UnsupportedHandlerTrampoline;
    FSDK_SetUnSpObjProcessHandler(info);
  }
Exemplo n.º 6
0
void EmbedderTest::SetUp() {
    v8::V8::InitializeICU();

#ifdef V8_USE_EXTERNAL_STARTUP_DATA
    ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_));
    ASSERT_TRUE(GetExternalData(g_exe_path_, "snapshot_blob.bin", &snapshot_));
    v8::V8::SetNativesDataBlob(&natives_);
    v8::V8::SetSnapshotDataBlob(&snapshot_);
#endif  // V8_USE_EXTERNAL_STARTUP_DATA

    FPDF_InitLibrary();

    UNSUPPORT_INFO unsuppored_info;
    memset(&unsuppored_info, '\0', sizeof(unsuppored_info));
    unsuppored_info.version = 1;
    unsuppored_info.FSDK_UnSupport_Handler = Unsupported_Handler;
    FSDK_SetUnSpObjProcessHandler(&unsuppored_info);
  }
Exemplo n.º 7
0
	void AddRef()
	{
		::EnterCriticalSection(&cs);

		if (refCount == 0)
		{
			v8::V8::InitializeICU();
			platform = v8::platform::CreateDefaultPlatform();
			v8::V8::InitializePlatform(platform);
			v8::V8::Initialize();

			FPDF_InitLibrary();
		}

		refCount++;

		::LeaveCriticalSection(&cs);
	}
Exemplo n.º 8
0
 CS_PDFIUM_EXPORT void initialize()
 {
   FPDF_InitLibrary();
 }