Jump to content

Recommended Posts

Posted

New example 

QuickPdf_ArrowHead.au3

 

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

_QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1114.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(10, 10, 100, 10, 10, 15, 1, 3)

; #FUNCTION# ====================================================================================================================
; Name ..........: _QPDF_Arrow
; Description ...: Draw Arrow with ArrowHeads
; Syntax ........: _QPDF_Arrow($iX1, $iY1, $iX2, $iY2[, $iArrowHeadLenPercent = 10[, $iArrowHeadAngleDegree = 10[,
;                  $iArrowThickness = 0.1[, $iArrowHeadThickness = 0.1]]]])
; Parameters ....: $iX1                      - an integer value.
;                  $iY1                      - an integer value.
;                  $iX2                      - an integer value.
;                  $iY2                      - an integer value.
;                  $iArrowHeadLenPercent     - [optional] an integer value. Default is 10. In relation to the length of the arrows.
;                  $iArrowHeadAngleDegree    - [optional] an integer value. Default is 10.
;                  $iArrowThickness          - [optional] an integer value. Default is 0.1.
;                  $iArrowHeadThickness      - [optional] an integer value. Default is 0.1.
; Return values .: None
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.quickpdf.org/forum/drawing-of-the-arrowhead-on-the-end-of-drown-line_topic3155.html
; Example .......: No
; ===============================================================================================================================
Func _QPDF_Arrow($iX1, $iY1, $iX2, $iY2, $iArrowHeadLenPercent = 10, $iArrowHeadAngleDegree = 10, $iArrowThickness = 0.1, $iArrowHeadThickness = 0.1)
    Local $oQP
    If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then

        $oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft);
        $oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)
        $oQP.SetLineCap(1)
        $oQP.SetLineWidth($iArrowThickness)
        $oQP.Drawline($iX1, $iY1, $iX2, $iY2)

        Local $iX12 = $iX2 - $iX1
        Local $iY12 = $iY2 - $iY1

        ; Assign a Local constant variable the approximate PI number.
        Local Const $PI = _Radian(180)

        $iArrowHeadAngleRadian = _Radian($iArrowHeadAngleDegree)

        ; Tan(angle) = Y / X
        ; Atan(X / Y) = angle
        Local $iArrowRadian = ATan($iY12 / $iX12)
        Local $iReverseArrowRadian = $iArrowRadian + $PI

        Local $iArrowLength
        If $iY12 = 0 Then
            $iArrowLength = $iX12
        Else
            ; Sin(angle) = Y / Len
            $iArrowLength = $iY12 / Sin($iArrowRadian)
        EndIf

        Local $iArrowHeadLength = $iArrowLength * $iArrowHeadLenPercent / 100

        Local $iRadianTiltedToTheRight = $iReverseArrowRadian + $iArrowHeadAngleRadian
        Local $iRadianTiltedToTheLeft = $iReverseArrowRadian - $iArrowHeadAngleRadian

        ; tg(angle) = Y / X
        ; ctg(angle) = X / Y
        ; sin(angle) = Y / $iArrowHeadLength
        ; cos(angle) = X / $iArrowHeadLength

        $oQP.SetLineWidth($iArrowHeadThickness)
        $oQP.Drawline($iX2, $iY2, $iX2 + Cos($iRadianTiltedToTheRight) * $iArrowHeadLength, $iY2 + Sin($iRadianTiltedToTheRight) * $iArrowHeadLength)
        $oQP.Drawline($iX2, $iY2, $iX2 + Cos($iRadianTiltedToTheLeft) * $iArrowHeadLength, $iY2 + Sin($iRadianTiltedToTheLeft) * $iArrowHeadLength)

        ; _QPDF_Display($oQP)
    EndIf
EndFunc   ;==>_QPDF_Arrow
#EndRegion TESTING

 

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

Can I get some text from a PDF file with this security info:

Security Method                            = Adobe Standard Security
User Password                            = No
Owner Password                            = Yes
Printing                                = Fully Allowed
Changing the Document                    = Not Allowed
Content Copying or Extraction            = Not Allowed
Authoring Comments and Form Fields        = Not Allowed
Form Field Fill-in or Signing            = Not Allowed
Content Accessibility Enabled            = Not Allowed
Document Assembly                        = Not Allowed
Encryption Level                        = 128-bit RC4 (Acrobat 5.x)
Opened with User password                = Yes
Opened with Owner password                = No
Variable Encryption Strength            = None

Posted (edited)

Hello @Andreik

I made some example:

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

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

_QPDF_NewLibraryPath_Commercial(@ScriptDir & '\DebenuPDFLibraryAX1114.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'))

Local $sPDF_FileFullPath = @ScriptDir & '\Test_Extract_Secured.pdf'

Local $oQP
If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then
    $oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft);
    $oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)
    $oQP.SetTextSize(20);
    $oQP.DrawText(10, 20, "Hello world")
;~  Local $iPermissions = $oQP.EncodePermissions(1, 0, 1, 1, 1, 1, 1, 1)
    Local $iPermissions = $oQP.EncodePermissions(0, 0, 0, 0, 0, 0, 0, 0)
    $oQP.Encrypt('Test1', '', 2, $iPermissions)

    If $oQP.SaveToFile($sPDF_FileFullPath) = 1 Then
        While _WinAPI_FileInUse($sPDF_FileFullPath)
            Sleep(10)
        WEnd
        ShellExecuteWait($sPDF_FileFullPath)
    Else
        MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sPDF_FileFullPath & " could not be saved.")
    EndIf
    $oQP = ''

    ; Create new object to be sure this is not still opened document
    Local $oQP2 = ''
    If _QPDF_CreateObjectAndUnlock($oQP2) = 1 Then
        If $oQP2.LoadFromFile($sPDF_FileFullPath, '') = 1 Then
            MsgBox(0, 'Extracted text', $oQP2.GetPageText(7))
        EndIf
        $oQP2 = ''
    EndIf

EndIf

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    MsgBox( 0, '', @ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF _
            )
EndFunc   ;==>_ErrFunc

I attach my Test PDF (created by this example snippet):  Test_Extract_Secured.pdf

Check it if this permisions and security settings meets your needs (if they are the same as in your case)

Conclusion: I can say: You can extract text from such a PDF as I created in this post.

 

Cheers,

mLipok

 

 

Edited by mLipok
wording, new - better example script

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

Thank you for your answer but I can't get this work well. Please let me know if I am doing this right:

1. I downloaded Debenu Quick PDF Library - UDF 

2. I downloaded Dabenu ActiveX Edition

3. Move from C:\Program Files (x86)\Debenu\PDF Library\ActiveX\DebenuPDFLibraryAX1115.dll to my script dir

4. Edited in your example above line

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

with

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

 

After this I run the script and I got this error even if I specify I want to use version 1115.

 

  Quote

Dll file does not exist:

C:\Users\Andreik\Desktop\QuickPDF v0.7\DebenuPDFLibraryLite1114.dll
 

 

Posted

licencse code ?

and I think I do not update my UDF. Wait a moment I must check.

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)

"DebenuPDFLibraryAX1115.dll" this is name of commercial version.

Lite is "DebenuPDFLibraryLite1115.dll"

Which UDF version you are using ?

Is there "

Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1115.dll')

" in function :

Func _QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath)
    Select
        ........
        Case StringInStr($sDLL_FileFullPath, 'DebenuPDFLibraryAX1115.dll')
            __QPDF_NewLibraryPath_Commercial($sDLL_FileFullPath, 'DebenuPDFLibraryAX1115.PDFLibrary', '{07D8A1AA-D36A-49E8-9887-E7EFA803787B}', '{E15526AB-9CCA-4A0F-AEDB-02EA65C34232}')
        Case Else
            MsgBox($MB_SYSTEMMODAL + $MB_OK + $MB_ICONERROR, 'Error', 'Invalid $sDLL_FileFullPath')
    EndSelect
EndFunc   ;==>_QPDF_NewLibraryPath_Commercial

 

btw.
With Lite version you can only extract entire pages (spliting), and can not extract images, or text.

 

EDIT

  On 8/17/2015 at 3:44 PM, Andreik said:

It works just with commercial license code? I tried free version.

you can also use Evaluation code to test how this works but only for 30 days.

 

Edited by mLipok
wording

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)

Yes but if you do not set License code Lite version will be used so UDF is searching for 

; Lite Library:  DebenuPDFLibraryLite1114.dll
Global $__sDebenuPDFLibraryLite_FileFullPath = @ScriptDir & '\DebenuPDFLibraryLite1114.dll'
Global Const $__sClassName_QPDF_Lite = 'DebenuPDFLibraryLite1114.PDFLibrary'
Global Const $__sCLSID_Lite = '{23860CC8-15E7-4AA8-931B-791A98001431}'
Global Const $__sIID_Lite = '{F9A0E70D-A4CC-43B7-9007-11362219DB79}'

as I do not add 1115 lite to the UDF because Lite was submited 6 day later.

 

EDIT:
You can use your evalutation licecense key code which should be in such path:

"c:\Program Files (x86)\Debenu\PDF Library\TRIAL_LICENSE_KEY.TXT" 

 

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

  • 6 months later...
Posted (edited)

@mLipok - I searched but nothing directly came up...

I have a compile EXE.  It uses DebenuPDFLite...  On 64bit I have a 64bit EXE.  Must I have a 64bit DebenuPDF to work with my 64 bit EXE?

Sorry if this is really obvious, but I was hoping to mix and match 32 & 64 bit...

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Posted (edited)

@mLipok, 2nd question,  when I generate a PDF, is there a "close" process that I must do before I start the next job?  First job generates fine, then it hangs up on 2nd...  I am trying to eliminate paper and generate all reports in PDF, then the user can choose to print...

ideas?

[improved question]

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Posted

You should use:

DebenuPDFLibrary64AX1212.dll
or
DebenuPDFLibrary64Lite1114.dll

Unfortunately my UDF is not prepared for it.
But glancing at it tonight.

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)

Thank you. That means it right now it only works with 32 bit... ? not a problem, just need to know what the limitations are.

Asof 26 Feb 2016 AutoIt only work with 32bit Debenu PDF library.

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Posted
  On 2/26/2016 at 2:33 PM, Skysnake said:

@mLipok, 2nd question,  when I generate a PDF, is there a "close" process that I must do before I start the next print job?  First job generates fine, then it hangs up on 2nd...

Expand  

Print ? in commercial version ?
Or you mean just making PDF ?

You can use NewDocument or RemoveDocument

 

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

  • 3 months later...
Posted

New version:

  Quote

===================================================
    2015/08/xx
    v0.8 alpha-1
    *
    QuickPDF.au3
    *    Added: Function:  _QPDF_Arrow() - mLipok
    *    Added: ENUMS: $QPDF_EXT_ - mLipok
    *    Added: ENUMS: $QPDF_RET_DEFAULT = 0, $QPDF_RET_FAILURE = -1 - mLipok
    *
    *    !!!!!!!!!!!!!!! SCRIPT BREAKING CHANGE !!!!!!!!!!!!!!!
    *    Changed: ENUMS:  $__EQPDF_RETURN_ >> $QPDF_RET_ - mLipok
    *    Changed: ENUMS:  $__eQPDF_ERROR_ >> $QPDF_ERR_ - mLipok
    *    Changed: ENUMS:  $QPDF_ERR_ALL_IS_OK >> $QPDF_ERR_OK - mLipok
    *    Renamed: Function: __QPDF_ObjIsValid >> __QPDF_IsValidObject - mLipok
    *    Changed: ENUMS:  $QPDF_RET_  changed concept - ERRORS are < 0 - mLipok
    *            but if you want to check I function return with Succesc you must chceck
    *    Removed: ENUM: $QPDF_RET_OBJCREATE_ERROR - mLipok
    *    Removed: ENUM: $QPDF_RET_INVALID_COMMERCIAL_LICENSE_KEY - mLipok
    *
    *
    ===================================================
    2015/11/06
    v0.8 alpha-2
    *
    *    Added: support for QPDFLibrary 12.11 - now is default - mLipok
    *
    *
    ===================================================
    2015/11/17
    v0.8 alpha-3
    *
    *    New: Function: _QPDF_PageEnumerator - mLipok
    *    New: Function: _QPDF_Example_ExtractImages - mLipok
    *    Renamed: Enum: $QPDF_ERR_ISLITEINSTEADCOMMERCIAL >> $QPDF_ERR_ISLITE - mLipok
    *    Renamed: Enum: $QPDF_ERR_ISCOMMERCIALINSTEADLITE >> $QPDF_ERR_ISCOMMERCIAL - mLipok
    *    Renamed: Enum: $QPDF_ERR_ISNOTBEBENUOBJECT >> $QPDF_ERR_ISNOTBEBENU - mLipok
    *    Added: support for   DebenuPDFLibraryCPAX1211.dll  - mLipok
    *       http://labs.debenu.com/2015/11/09/debenu-quick-pdf-library-12-11-downloads/
    *       http://www.debenu.com/downloads/installers/debenu_quick_pdf_library_win.zip
    *    Changed: Function: _QPDF_Page_2in1_File - on succes return $sSAVE_FileFullPath - mLipok
    *
    *
    ===================================================
    2016/06/13
    v0.8
    *
    *     Added: support for DebenuPDFLibraryAX1212.dll - Now this is default setting - mLipok
    *    Added: #Au3Stripper_Ignore_Funcs=_QPDF_Shutdown - mLipok
    *    Changed: Refactored (If Then Else EndIf + Return) in many funciton - mLipok

Expand  

and new examples.

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

Posted

:bike: brum brum...... :D

 

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

Same environments as with 0.7.  All works as expected.  However, it appears slower?  Is that possible?

Skysnake

Why is the snake in the sky?

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...