Frequently Asked Question:
Can I use Quick PDF to render to GTK Device Context?
Question
Can I use Quick PDF to render to GTK Device Context?
Answer
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);