1

Can I use Quick PDF to render to GTK Device Context?

flag

1 Answer

0

Yes, it is possible to use Quick PDF Library to render to GTK device context. Here is some sample C++ code demonstrating how to do this:

BOOL CPDFViewerDlg::OnInitDialog()
{
  CDialog::OnInitDialog (MFC)

// Draw updated page
m_iDAFileHandle = m_QP.DAOpenFile(m_strFile, CString(_T("")));
m_iPageRef = m_QP.DAFindPage(m_iDAFileHandle, 1);
// Resize window based on new PDF
MoveWindow(0, 0, m_QP.DAGetPageWidth(m_iDAFileHandle, m_iPageRef), 
m_QP.DAGetPageHeight(m_iDAFileHandle, m_iPageRef),TRUE);
// Set the dialog title
CString strTitle;
::GetFileTitle(m_strFile, strTitle.GetBufferSetLength(1024), 1024);
strTitle.ReleaseBuffer();

// Recenter the dialog in the center of the active window
CenterWindow(GetDesktopWindow());

return TRUE;  // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

void CPDFViewerDlg::OnPaint()
{
CPaintDC dc(this);
m_QP.DARenderPageToDC(m_iDAFileHandle, m_iPageRef, 72,(int) (HDC) dc);
link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.