Jump to content

Recommended Posts

Posted

Related topics:

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 2 years later...
Posted

a small update ;) 

  Reveal hidden contents

 

 

Download link:

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 year later...
Posted

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 9 months later...
Posted

Hello mLipok, I am just trying to use your UDF and I have downloaded trial of Quick PDF Library so far and I tried to run your first example QuickPDF_ArrowHead.au3 but with no luck. Nothing appeared.

;~ #AutoIt3Wrapper_Run_Debug_Mode=Y
#Tidy_Parameters=/sort_funcs /reel
#include-once
#include <Math.au3>
#include "QuickPdf.au3"

_QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1311.dll')

; SET YOUR LICENSE KEY in your main script using _QPDF_SetLicenseKey()
; If you not set $__sLicenseKey_QPDF then DebenuPDFLibraryLite1114.dll will be used (Lite version).
_QPDF_SetLicenseKey('ENTER YOUR KEY HERE')

; I (mLipok) use MyLicenseKey.txt file to prevent accidentally placed my license key in a public forum.
If FileExists(@ScriptDir & '\MyLicenseKey.txt') Then _QPDF_SetLicenseKey(FileRead(@ScriptDir & '\MyLicenseKey.txt'))

#Region TESTING

_QPDF_Arrow_Example()

Func _QPDF_Arrow_Example()
    Local $oQP
    If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then
        $oQP.SetLineColor(1,0,0)
        _QPDF_Arrow($oQP, 10, 10, 100, 80, 5, 8, 0.5, 0.7)
        $oQP.SetLineColor(0,1,0)
        _QPDF_Arrow($oQP, 10, 20, 100, 90, 10, 8, 0.5, 1)
        $oQP.SetLineColor(0,0,1)
        _QPDF_Arrow($oQP, 10, 100, 100, 100, 10, 145, 1, 2)
        _QPDF_Display($oQP)
    EndIf
EndFunc   ;==>_QPDF_Arrow_Example
#EndRegion TESTING

I can't find file 'DebenuPDFLibraryAX1311.dll' in my local installation folder.

I tried with all dll files in DLL folder but with no success.

image.png.9721aa851569ff87ab4c735b8f631a42.png

I have entered my licence key but _QPDF_CreateObjectAndUnlock($oQP) return 0 value.

Any idea?

Posted
  On 10/19/2021 at 6:30 PM, maniootek said:

I have entered my licence key but _QPDF_CreateObjectAndUnlock($oQP) return 0 value.

Expand  

here:

  On 10/19/2021 at 6:30 PM, maniootek said:

_QPDF_SetLicenseKey('ENTER YOUR KEY HERE')

Expand  

or you put this to your's file:

  On 10/19/2021 at 6:30 PM, maniootek said:

If FileExists(@ScriptDir & '\MyLicenseKey.txt') Then _QPDF_SetLicenseKey(FileRead(@ScriptDir & '\MyLicenseKey.txt'))

Expand  

?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/19/2021 at 6:30 PM, maniootek said:

_QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1311.dll')

Expand  

btw. I think that you should also use proper path.
Recent version was DebenuPDFLibraryAX1811.dll

Which version you have downloaded with your trial ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

this is what my folder looks like: 

image.png.93affc9f217da3d37372ee312b14e6e2.png

in the MyLicenseKey I left 1 line with licence key
all dll files comes from "C:\Program Files (x86)\Foxit Software\Quick PDF Library 18\DLL" path

I have downloaded and installed this file "foxit_quick_pdf_library_1811_en.exe"

Edited by maniootek
Posted (edited)

a... I think I know why
Which recent version you have in _QPDF_NewLibraryPath_Commercial()

As so far I forgot to make update for 1811:

.....

        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1711.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1711.PDFLibrary', '{B4B2C260-6F9E-4C79-8010-8983CCF3A0A6}', '{68CE66E2-BBBE-4094-965D-7A42243468E8}')
        Case Else
            SetError($QPDF_ERR_DLLINIT, $QPDF_EXT_PARAM1, $QPDF_RET_FAILURE)
    EndSelect
EndFunc   ;==>_QPDF_NewLibraryPath_Commercial


EDIT:
WorkInProgress

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

@maniootek

Try to modify _QPDF_NewLibraryPath_Commercial()

 

....
....

        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1612.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1612.PDFLibrary', '{4C108812-C084-418D-A7D5-0A2632C8406C}', '{88F2FB50-6844-432E-A3A6-840C1259568B}')
        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1613.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1613.PDFLibrary', '{7DC849CE-EBD0-4B7C-8A46-A299E9540AF0}', '{99C7568E-DCE9-465C-AC47-35A7913D8725}') ; @TODO QUESTION / TEST : should here be DebenuPDFLibraryAX1613.PDFLibrary or DebenuPDFLibraryAX1612.PDFLibrary ??
        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1711.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1711.PDFLibrary', '{B4B2C260-6F9E-4C79-8010-8983CCF3A0A6}', '{68CE66E2-BBBE-4094-965D-7A42243468E8}')
        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1811.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1811.PDFLibrary', '{6876E803-14CA-4ABF-9075-24F087AE8868}', '{12146AAC-0348-4A1A-A207-742FAAF8C80D}')
        Case Else
            SetError($QPDF_ERR_DLLINIT, $QPDF_EXT_PARAM1, $QPDF_RET_FAILURE)
    EndSelect
EndFunc   ;==>_QPDF_NewLibraryPath_Commercial


Let me know if this modification works for you.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I want to:

1. read pdf file with multiple pages and split each page into array elements in autoit

2. loop through the array and read text from each page

3. loop through the array and add new text to each page

4. change order of elements in array (sort with special condition)

5. save new pdf file with new pages order

Is it possible with lite version or commercial?

Will you help me? Please guide me which function should I use.

First of all I want to load pdf file to memory. I found in your UDF function called "_QPDF_CreateObjectFromFile"

Func _QPDF_CreateObjectFromFile($sPDF_FileFullPath, $sPDF_Password = '')
    Local $oQP
    _QPDF_CreateObjectAndUnlock($oQP)
    If @error Then Return SetError(@error, @extended, $QPDF_RET_FAILURE)

    _QPDF_LoadFromFile($oQP, $sPDF_FileFullPath, $sPDF_Password)
    If @error Then Return SetError($QPDF_ERR_LOADFILE, @extended, $QPDF_RET_FAILURE)

EndFunc   ;==>_QPDF_CreateObjectFromFile

but it looks like it does not return anything in case of no error?

Second thing is that your example file "QuickPDF_Examples.au3" use old functions

_QPDF_LastErrorCode > _QPDF_LastError_SetCode
_QPDF_SaveToFile_Lite > _QPDF_SaveToFile

Posted
  On 10/20/2021 at 8:00 AM, maniootek said:

Is it possible with lite version or commercial?

Expand  

Possible with commercial but the most important is what you exactly expect here:

  On 10/20/2021 at 8:00 AM, maniootek said:

4. change order of elements in array (sort with special condition)

Expand  

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/20/2021 at 8:00 AM, maniootek said:

but it looks like it does not return anything in case of no error?

Expand  

Are you sure that ?
How did you check this ?
Did you try for example to provide incorrect password or put not existing PDF file path ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/20/2021 at 8:00 AM, maniootek said:

Second thing is that your example file "QuickPDF_Examples.au3" use old functions

_QPDF_LastErrorCode > _QPDF_LastError_SetCode
_QPDF_SaveToFile_Lite > _QPDF_SaveToFile

Expand  

Do not know what you refering ... I must check later. Currently I'm a bit bussy, at work.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/20/2021 at 8:07 AM, mLipok said:

Possible with commercial but the most important is what you exactly expect here:

4. change order of elements in array (sort with special condition)

Expand  

this should not be a problem once the pdf pages objects will be in the 1D array and then we find option to merge all of them into one pdf file

if this be possible then i just change order of elements in array (pages) 

  On 10/20/2021 at 8:08 AM, mLipok said:

Are you sure that ?
How did you check this ?
Did you try for example to provide incorrect password or put not existing PDF file path ?

Expand  

It might work when password is wrong or file not exists but it deos not return anything when everything is good. I didn't check the function with the real data but I just looked into the code. There is no RefBy in fuction parameter or Return value on function success. This function could return $QPDF_RET_FAILURE or nothing.

In another words. Your function missing "Return $oQP" code line.

 

  On 10/20/2021 at 8:10 AM, mLipok said:

Do not know what you refering ... I must check later. Currently I'm a bit bussy, at work.

Expand  

I just tried to say that your example file contains function which does not exists anymore in udf. It's just a notice. Nothing bad.

Edited by maniootek
Posted
  On 10/20/2021 at 8:25 AM, maniootek said:

I didn't check the function, I just looked into the code. There is no RefBy in fuction parameter or Return value on function success. This function could return $QPDF_RET_FAILURE or nothing. I am not sure and I might be wrong.

Expand  

in my current dev version I had:
 

; #FUNCTION# ====================================================================================================================
; Name ..........: _QPDF_CreateObjectFromFile
; Description ...: Create object by loading file into
; Syntax ........: _QPDF_CreateObjectFromFile($sPDF_FileFullPath[, $sPDF_Password = ''])
; Parameters ....: $sPDF_FileFullPath   - A string value. PDF file full path.
;                  $sPDF_Password       - [optional] A string value. Default is ''.
; Return values .: QPDF Object or $QPDF_RET_FAILURE
; Author ........: mLipok
; Modified ......:
; Remarks .......:  If the function succeeds, the loaded document will be selected and its DocumentID can be retrieved using the SelectedDocument function.
;                  Password is needed only if PDF File is encrypted.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _QPDF_CreateObjectFromFile($sPDF_FileFullPath, $sPDF_Password = '')
    Local $oQP
    _QPDF_CreateObjectAndUnlock($oQP)
    If @error Then Return SetError(@error, @extended, $QPDF_RET_FAILURE)

    _QPDF_LoadFromFile($oQP, $sPDF_FileFullPath, $sPDF_Password)
    If @error Then Return SetError($QPDF_ERR_LOADFILE, @extended, $QPDF_RET_FAILURE)

    Return SetError($QPDF_ERR_SUCCESS, $QPDF_EXT_DEFAULT, $oQP)

EndFunc   ;==>_QPDF_CreateObjectFromFile

hmm... maybe it is time to release new version....

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I tried to extract pages 2 and 3 and mege it together. This is my code:

#include "QuickPdf.au3"
#include <Array.au3>

Example_ExtractAndMergePages()

Func Example_ExtractAndMergePages()
    _QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1811.dll')
    _QPDF_SetLicenseKey(FileRead(@ScriptDir & '\MyLicenseKey.txt'))
    _QPDF_UseErrorHandler()

    Local $oQP1 = _QPDF_CreateObjectFromFile(@ScriptDir & "\Example_10page.pdf")
        $oQP1.ExtractPages(2, 1)
        $oQP1.SetOrigin(1)
        $oQP1.DrawText(25, 25, "page 2");
        Local $PrimaryDoc = $oQP1.SelectedDocument()

    Local $oQP2 = _QPDF_CreateObjectFromFile(@ScriptDir & "\Example_10page.pdf")
        $oQP2.ExtractPages(3, 1)
        $oQP2.SetOrigin(1)
        $oQP2.DrawText(25, 25, "page 3");
        Local $SecondaryDoc = $oQP2.SelectedDocument()


    Local $oQP_final
        _QPDF_CreateObjectAndUnlock($oQP_final)
        $oQP_final.SelectDocument($PrimaryDoc);
        $oQP_final.MergeDocument($SecondaryDoc);

    $sFileName = @ScriptDir & "\Example_2and3page.pdf"
    FileDelete($sFileName)
    If $oQP_final.SaveToFile($sFileName) = 1 Then
        While _WinAPI_FileInUse($sFileName)
            Sleep(10)
        WEnd
        ShellExecuteWait($sFileName)
    Else
        MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sFileName & " could not be saved.")
    EndIf

EndFunc

but it save empty page

I based on example from "Foxit Quick PDF Library Dashboard" and "Combine two PDFs together"

image.thumb.png.1398a94e2038d379ba79d698f8bbfdea.png

Edit: By the way, I fixed _QPDF_CreateObjectFromFile() function and now it's working properly

Edit2: Nvm, i just figured it out myself. This is working code:

#include "QuickPdf.au3"
#include <Array.au3>

Main()

Func Main()
    _QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1811.dll')
    _QPDF_SetLicenseKey(FileRead(@ScriptDir & '\MyLicenseKey.txt'))
    _QPDF_UseErrorHandler()

    Local $oQP
    _QPDF_CreateObjectAndUnlock($oQP)

    _QPDF_LoadFromFile($oQP, @ScriptDir & "\Example_10page.pdf")
    $oQP.ExtractPages(2, 1)
    $oQP.SetOrigin(1)
    $oQP.DrawText(25, 25, "page 2");
    Local $PrimaryDoc = $oQP.SelectedDocument()

    _QPDF_LoadFromFile($oQP, @ScriptDir & "\Example_10page.pdf")
    $oQP.ExtractPages(3, 1)
    $oQP.SetOrigin(1)
    $oQP.DrawText(25, 25, "page 3");
    Local $SecondaryDoc = $oQP.SelectedDocument()

    $oQP.SelectDocument($PrimaryDoc);
    $oQP.MergeDocument($SecondaryDoc);

    $sFileName = @ScriptDir & "\Example_2and3page.pdf"
    FileDelete($sFileName)
    If $oQP.SaveToFile($sFileName) = 1 Then
        While _WinAPI_FileInUse($sFileName)
            Sleep(10)
        WEnd
        ShellExecuteWait($sFileName)
    Else
        MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sFileName & " could not be saved.")
    EndIf

EndFunc

 

Edited by maniootek
Posted

try to use: $oQP.SaveToVariant() instead $oQP.SaveToFile() and store the result to ARRRAY element

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/20/2021 at 10:15 AM, mLipok said:

try to use: $oQP.SaveToVariant() instead $oQP.SaveToFile() and store the result to ARRRAY element

Expand  

ok but why?

I am also wondering why my console keep show this message:

 

  Quote

! __QPDF_ErrorNotiffy: LastErrorDescription = 
! __QPDF_ErrorNotiffy: LastErrorDescription = 

Expand  

there is no description

  • 2 weeks later...
Posted

@maniootek How do you deal with QPDF?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...