Print Page | Close Window

How to open PDF file using Debebu

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3227
Printed Date: 23 Nov 24 at 12:40AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to open PDF file using Debebu
Posted By: lakkan
Subject: How to open PDF file using Debebu
Date Posted: 10 Dec 15 at 12:50PM
Hi,Cry

Please help me, how I can open PDF file using Debebu in win32 c programming..

Lakkan



Replies:
Posted By: Ingo
Date Posted: 10 Dec 15 at 9:41PM
Hi,

what do you mean with "how can i open"?
If you wanna work with the pdf-file i think you'll mean "LoadFromFile".
If you wanna open or show a pdf-file you'll don't need the library. Something like "ShellExecute" should be enough.
if you wanna create something similar to a pdf-reader you#ll find starting code here in the samples section.

Code-samples you can find here:
http://www.debenu.com/products/development/debenu-pdf-library/help/samples/
Tutorials you can find here:
http://www.debenu.com/products/development/debenu-pdf-library/help/tutorials/
The complete documentation and a developer guide you can find here:
http://www.quickpdf.org/
Further/advanced sample codes you can find here in the samples section of the forum:
http://www.quickpdf.org/forum/sample-code_forum13.html

Cheers and welcome here,
Ingo




-------------
Cheers,
Ingo



Posted By: lakkan
Date Posted: 11 Dec 15 at 12:17PM
Hi Ingo,

Thanks for your help..

Here is my problem >
Step1:
 I create a window  using create function , PDataLibrary is an instance of Outside In Library
CreateWindowEx(0,string_load(c_string0185),NULL,WS_CHILD,0,0,0,0,(HWND)pDataParent,0,(HINSTANCE)pDataLibrary,0);

Step2: 
Here we use SendMessage function to display the PDF file in the window that is created above.

[SCCVW_VIEWFILE is a message supported by OutsideIn]

nReturn=SendMessage((HWND)image_puForeign->pDataStellent,SCCVW_VIEWFILE,0,(LPARAM)&uVF);

Now, we wanted  to go with Debenu Library ..
1.How can I open a file using above window that is already created?
2.Should I create a new window, which will associate with Debenu Library toolkit?
3.Can I use send message / or is there any function available in Debenu which opens PDF file in a viewer that is already created?
 
Could you please help me on this..

Lakkan


Posted By: mLipok
Date Posted: 11 Dec 15 at 11:24PM
I think you do not mean open but display ?
if so here is my example:

; #FUNCTION# ====================================================================================================================
; Name ..........: _QPDF_Display
; Description ...: Display PDF Document
; Syntax ........: _QPDF_Display($oQP[, $sPDF_Display_Comment = ''[, $iLeft = -1[, $iTop = 0[, $iWidth = 800[, $iSelectPage = 1]]]]])
; Parameters ....: $oQP                 - [in/out] Reference to a QuickPDF object.
;                  $sPDF_Display_Comment- [optional] A string value. Default is ''.
;                  $iLeft               - [optional] An integer value. Default is -1.
;                  $iTop                - [optional] An integer value. Default is 0.
;                  $iWidth              - [optional] An integer value. Default is 800.
;                  $iSelectPage         - [optional] An integer value. Default is 1.
; Return values .: TODO
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _QPDF_Display($oQP, $sPDF_Display_Comment = '', $iLeft = -1, $iTop = 0, $iWidth = 800, $iSelectPage = 1)
Local $sPDF_Display_Title = 'QuickPDF Test Display: ' & $sPDF_Display_Comment
If Not IsObj($oQP) Then
; TODO
Else
; select Page
$oQP.SelectPage($iSelectPage);
$oQP.SetOrigin(0)
$oQP.SetMeasurementUnits(0)
$oQP.NormalizePage(0)
$oQP.CombineContentStreams()
$oQP.SelectContentStream(1)
; Local $sOutput
; $sOutput &= BinaryToString($oQP.GetContentStreamToVariant()) & @CRLF
; $oQP.SelectContentStream(1)

; calculate DPI
Local $iPageWidth = $oQP.PageWidth();
Local $iPageHeight = $oQP.PageHeight();
; Local $iInches = $iPageWidth / 72
Local $iDisplayDPI = ($iWidth / $iPageWidth) * 72

; create GUI
Local $iHeight = ($iWidth * $iPageHeight) / $iPageWidth
Local $hWND_QP_TestDisplay = GUICreate($sPDF_Display_Title, $iWidth, $iHeight, $iLeft, $iTop)
GUISetState(@SW_SHOW)
Local $hDC = _WinAPI_GetDC($hWND_QP_TestDisplay)

; render QP object to Device Context
$oQP.RenderPageToDC($iDisplayDPI, $iSelectPage, $hDC);

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
_WinAPI_ReleaseDC($hWND_QP_TestDisplay, $hDC)
GUIDelete($hWND_QP_TestDisplay) ; Deletes a GUI window and all controls that it contains.
EndIf
EndFunc   ;==>_QPDF_Display


Of course in C++ (as I think you are using this DevEnv ) it is not so easy, as in my example, but this showing you the way, and you should now know what you need to do.

Best regards,
mLipok



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: lakkan
Date Posted: 15 Dec 15 at 7:37AM
Hi mLipok,

Thanks for your information..

Our product is written in C code,so How to integrate Debenu C++ Library in C project.. Do you have any 
solution for this..


RegardsAngry
Lakkan



Posted By: mLipok
Date Posted: 15 Dec 15 at 10:47AM
In C you can
Create GUI
Get DeviceContext
and finally use QP.RenderPageToDC

btw.
Here is how I get DC using AutoIt Standrd UDF

; #FUNCTION# ==================================================================================================================== ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; =============================================================================================================================== Func _WinAPI_GetDC($hWnd) Local $aResult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hWnd) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_GetDC

btw.
The best would be to use the library Debenu Viewer SDK, which I recommend.
As RenderPageToDC I use only for testing purpuose, 
and when I want to show PDF to the user then I prefer DEBENU Viewer SDK



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: lakkan
Date Posted: 15 Dec 15 at 2:32PM
The problem is when I add -- #include "DebenuPDFLibraryDLL1115.h" to the  c project , it throws following errors, when I compile the code:

error 2061 :  syntax error : identifier 'acosf'
error 2059 : syntax error  : identifier 'asinf'

is there any way to overcome this..

1. It looks like, you can not call C++ class from C code..
2. Do you have any solution for this..




Posted By: Ingo
Date Posted: 15 Dec 15 at 8:23PM
Hi Lakkan,

i've tried Google with your post ;-)
These two links will solve your prob:
http://stackoverflow.com/questions/9514475/compiling-error-in-c-project-with-c-and-c-codes
http://stackoverflow.com/questions/18798756/error-c2061-syntax-error-identifier-acosf-when-using-curl

Cheers, Ingo



-------------
Cheers,
Ingo



Posted By: lakkan
Date Posted: 21 Dec 15 at 1:52PM
Hi Ingo,

Thanks for your information..

I have one more problem.. I could able to create an object of Debenu only when I add
 #include "DebenuPDFLibraryDLL1115.cpp" to my C project.

But I wanted to make it work with #include "DebenuPDFLibraryDLL1115.h",  if I compile the project with header file, it throws following error..

Error 616 error LNK2019: unresolved external symbol "public: __thiscall DebenuPDFLibraryDLL1115::~DebenuPDFLibraryDLL1115(void)" (??1DebenuPDFLibraryDLL1115@@QAE@XZ) referenced in function @debenuPDF_Load@0 D:\Projects\Contentverse8\Build\Source\Viewer\WORK_BUILD\vwpdf.obj

Please can any one provide me help on this..


Regards
Lakkan


Posted By: tfrost
Date Posted: 21 Dec 15 at 3:42PM
It seems that you are trying to use the DLL interface.  In this case you should not include the cpp in your own application source file.  You just need to include the cpp as one of the source files in your project, then in your own applications you include the header file.  The cpp file implements the interface to the library code in the DLL, and the DLL needs to be installed with your application.

As an alternative, you can use the files in the LIB folder, with the simple .h file (without the 'DLL' in the name) and then link your application with the corresponding .LIB file.  Then your application will include the necessary library code in your own EXE.


Posted By: lakkan
Date Posted: 22 Dec 15 at 11:09AM
Hi Tfrost,

Thanks for your information and it is really useful..

Narayana Reddy.L


Posted By: lakkan
Date Posted: 04 Jan 16 at 2:00PM
Hi,Clap

Wish you a happy new year 2016.

Here is my problem, any help please.

Below piece of code, though it works, but PDF file is opened outside the application, where as window created  is part of parent window and it is part of my application.

I wanted PDF file, to be opened in a window, which is part of my application..

DebenuPDFLibraryDLL1211 QP(L"DebenuPDFLibraryDLL1211.dll");
//Library key    
std::wstring strLicenseKey = L"xxxxxxx5y"; 
// Unlock the library
int iResult = QP.UnlockKey(strLicenseKey);
int nState = QP.LoadState();


#if defined c_switchPlatformWIN32
      hWnd=CreateWindowEx(0,string_load(c_string0185),NULL,WS_CHILD,0,0,0,0,HWND)pDataParent,0,(HINSTANCE)nState,0); //Here window is created
hdc = ::GetDC(hWnd);   //Gets the device context of the above window

 #endif
int nLoad = QP.LoadFromFile(image_puForeign->acPathTemp,L""); //Here it loads PDF file

QP.RenderPageToDC(100, 1,hdc); //Render the PDF file


Lakkan



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk