Jump to content

Debenu Quick PDF Library - UDF


mLipok
 Share

Recommended Posts

:)

I want to use a different font in the header of a report.

This works

_QPDF_SetPageSize_Lite($oQP, 'A4') ; Landscape')
                        _QPDF_AddStandardFont_Lite($oQP, 0)
                        _QPDF_SelectFont_Lite($oQP, $__eQPDF_StandardFontID_CourierOblique)
                        $oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft) ;
                        $oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)

Now, I want to change the Font to "Arial" for a header, but it gives an error.  How do I set this?

; the top header box , line 1, center
                        _QPDF_SelectFont_Lite($oQP, "Arial") ;-- font
                        _QPDF_SetTextAlign_Lite($oQP, 1) ; align CENTER
                        $oQP.SetTextSize(12) ;
                        $oQP.DrawTextBox(25, 10, 165, 10, 'Print this text in an Arial font', 1)

Console provides this:

==> The requested action with this object has failed.:
$oQP.SelectFont($iFontID)
$oQP^ ERROR

--------------------------

Found this in the QuickPDf.au3

; Parameters for AddStandardFont, SelectFont
Const Enum _
        $__eQPDF_StandardFontID_Courier = 0, _
        $__eQPDF_StandardFontID_CourierBold, _
        $__eQPDF_StandardFontID_CourierBoldOblique, _
        $__eQPDF_StandardFontID_CourierOblique, _
        $__eQPDF_StandardFontID_Helvetica, _
        $__eQPDF_StandardFontID_HelveticaBold, _
        $__eQPDF_StandardFontID_HelveticaBoldOblique, _
        $__eQPDF_StandardFontID_HelveticaOblique, _
        $__eQPDF_StandardFontID_TimesRoman, _
        $__eQPDF_StandardFontID_TimesBold, _
        $__eQPDF_StandardFontID_TimesItalic, _
        $__eQPDF_StandardFontID_TimesBoldItalic, _
        $__eQPDF_StandardFontID_Symbol, _
        $__eQPDF_StandardFontID_ZapfDingbats

So I understand that these font parameters are hardcoded. Is it possible to use a different font.  That does exist locally?

Please help?

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Using Lite version you can only add standard font (standard == for AdobePDF , not in meaning standard windows font).
$oQP.SelectFont($iFontID) expect ID not name.

AddSubsettedFont is only in commercial version of this component :(

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Thanks for the prompt response.

This helped me How to find fonts

and my QuickPDF UDF includes these

embedded.png

This means that only the AddStandardFont, SelectFont options above can be included, right?  Is there anyway to customize that PDF to include another font?

Thanks

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

3 hours ago, Skysnake said:

This means that only the AddStandardFont, SelectFont options above can be included, right? 

Yes

3 hours ago, Skysnake said:

Is there anyway to customize that PDF to include another font?

Unfortunately I do not know such a possibility.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 2 months later...

Please help here?

What is this function supposed to do?

; this following is not example but a Function in UDF - but it can be used as an example
        _QPDF_MergeFiles_Lite()

I get a File Open dialogue.  What should happen next?  Is this a commercial function?

Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

_QPDF_MergeFiles_Lite()
Quote

; Description ...: Combine together all pdf from selected folder, quickly and easy

.....

; Parameters ....: $sDirFullPath        - A string value. Folder with PDF Files to Merge.
;                  $sFileFullPath       - A string value. Merged PDF file location
 

 

Select folder with PDFs files, which you want to merge.
Look for results in : @ScriptDir & "\Example_MergedFileList.pdf" 

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

; this following is not example but a Function in UDF - but it can be used as an example
    Local $mergedfile = _QPDF_MergeFiles_Lite()
    ConsoleWrite("69 $mergedfile "&$mergedfile&@CRLF)
On 7/25/2017 at 7:34 PM, mLipok said:
_QPDF_MergeFiles_Lite()

 

Select folder with PDFs files, which you want to merge.
Look for results in : @ScriptDir & "\Example_MergedFileList.pdf" 

 

Sorry, no.

I have tested 0.9 on Win7 Home Basic and Win10.  Both appear to do nothing.

>Running AU3Check (3.3.14.0)  from:C:\Program Files\AutoIt3  input:C:\AutoIt\DebenuPDF\QuickPDF v0.9\QuickPDF_Examples.au3
+>19:55:30 AU3Check ended.rc:0
>Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.9\QuickPDF_Examples.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>19:55:40 AutoIt3.exe ended.rc:0
+>19:55:40 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 11.35

Both the source folder and the @ScriptFolder do not contain the expected Example_MergedFileList.pdf file.

Changed this...

; this following is not example but a Function in UDF - but it can be used as an example
    Local $mergedfile = _QPDF_MergeFiles_Lite()
    ConsoleWrite("69 $mergedfile "&$mergedfile&@CRLF)

Output now

>Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.9\QuickPDF_Examples.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
69 $mergedfile 0
+>20:00:52 AutoIt3.exe ended.rc:0
+>20:00:52 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 10.51

What am I doing wrong?

 

More on this...

I found an old EXAMPLE_MERGEDFILELIST.PDF from 2015. Probably done with v0.8. :)

 

Sorry, there seems to be some issue with v0.9.  This example also fails: _Examples_Lite_Collection_For_Lelikkeo

In the FIRST POST you put

EDIT: actualy (19-06-2015) there is DebenuPDFLibraryAX1115.dll and DebenuPDFLibraryLite1115.dll

I have DebenuPDFLibraryLite1114.DLL. Is this a DLL issue?

Skysnake

Edited by Skysnake
more

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Please see the example _QPDF_Example_Lite_2_OneBigExample()

_QPDF_AddLinkToWeb_Lite($oQP, 25, 105, 50, 10, '', True) ; Left, Top, Wide, High, no hyperlink, Border True/False

I think the "options" referred to may be a boolean, not an integer.  True / False works, and 0,2,4 returns same result as False, while 1,3,5 returns same as True

:)

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • 2 weeks later...

I need some insight here please?

; Draw third line with changed atribute ; add funky fonts
        _QPDF_SetTextAlign_Lite($oQP, $__eQPDF_TEXTALIGN_Left)
        _QPDF_AddStandardFont_Lite($oQP, 12 ) ; $__eQPDF_StandardFontID_Symbol) ; 12
        _QPDF_AddStandardFont_Lite($oQP, 13 ) ; $__eQPDF_StandardFontID_ZapfDingbats) ; 13
        _QPDF_SelectFont_Lite($oQP, $__eQPDF_StandardFontID_Symbol)
        _QPDF_DrawText_Lite($oQP, 25, 110, "`1234567890-= ~!@#$%^&*()_+[]{}\|;':,./<>?")
        _QPDF_DrawText_Lite($oQP, 25, 120, "the quick brown fox jumps over the lazy dog ")
        _QPDF_DrawText_Lite($oQP, 25, 130, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG")

        _QPDF_SelectFont_Lite($oQP, $__eQPDF_StandardFontID_ZapfDingbats)
        _QPDF_DrawText_Lite($oQP, 25, 140, "the quick brown fox jumps over the lazy dog")
        _QPDF_DrawText_Lite($oQP, 25, 150, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG")
        _QPDF_DrawText_Lite($oQP, 25, 160, "`1234567890-= ~!@#$%^&*()_+[]{}\|;':,./<>?")

Produces

symbols.png

First, this is the same for my fonts selected ZapfDingbats and Symbols...

 

But, this is not the same produced by OpenOffice when choosing font Symbol

symbolsoo.png

 

I understand embedded fonts, but does this mean that

(a) the Zapf font and Symbols embedded are the same, and

(b) embedded Symbol font and and my Windows Font Symbol are not the same?

Specifically I am attempting to draw frames and boxes using the Lite library.  Forms to fill etc.

Please advise

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

On 26.07.2017 at 7:59 PM, Skysnake said:

I have DebenuPDFLibraryLite1114.DLL. Is this a DLL issue?

Yes my UDF is still using

Global $__sDebenuPDFLibraryLite_FileFullPath = @ScriptDir & '\DebenuPDFLibraryLite1114.dll'

I will check _QPDF_MergeFiles_Lite() when I back from my vacation .

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

On 31.07.2017 at 9:55 AM, Skysnake said:

Please see the example _QPDF_Example_Lite_2_OneBigExample()

_QPDF_AddLinkToWeb_Lite($oQP, 25, 105, 50, 10, '', True) ; Left, Top, Wide, High, no hyperlink, Border True/False

I think the "options" referred to may be a boolean, not an integer.  True / False works, and 0,2,4 returns same result as False, while 1,3,5 returns same as True

:)

 

I do not understand your assumpiont.

Func _QPDF_AddLinkToWeb_Lite(ByRef $oQP, $iLeft, $iTop, $iWidth, $iHeight, $sLink, $iOptions = 0)
    __QPDF_IsUnlocked($oQP)
    If @error Then Return SetError(@error, @extended, $QPDF_RET_FAILURE)

    $oQP.AddLinkToWeb($iLeft, $iTop, $iWidth, $iHeight, $sLink, $iOptions)
    Return 1
EndFunc   ;==>_QPDF_AddLinkToWeb_Lite

$iOptions should be integer as this is used in Debenu object as integer.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

On 8.08.2017 at 11:12 AM, Skysnake said:

I understand embedded fonts, but does this mean that

(a) the Zapf font and Symbols embedded are the same, and

(b) embedded Symbol font and and my Windows Font Symbol are not the same?

I do not know.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Working example

_QPDF_AddStandardFont_Lite($oQP, 13) ; $__eQPDF_StandardFontID_ZapfDingbats) ; 13
;~      _QPDF_SelectFont_Lite($oQP, $__eQPDF_StandardFontID_ZapfDingbats)
        $oQP.SetTextSize(20) ;
        _QPDF_DrawText_Lite($oQP, 186, 187, "$")

        _QPDF_AddStandardFont_Lite($oQP, 0)
;~      _QPDF_SelectFont_Lite($oQP, $__eQPDF_StandardFontID_CourierOblique)
        $oQP.SetTextSize(20) ;
        $oQP.DrawTextBox(20, 180, 176, 40, ". . . . . . . . . . . . . . . . . . .  ", 1)





$NewImage = @ScriptDir & "\mypic.bmp"
$oQP.AddImageFromFile($NewImage, 0)
$oQP.DrawImage(20, 200, 30, 30) ; left, top, wide, height

You should see a line of dots with a pair of scissors at the right margin :)

You must supply your own .bmp

Note this is with v0.8

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • 1 month later...

An example.  It shows all the fonts available, some underlining and text alignment, as well as some text draw and text draw box activity.

Func _QPDF_Example_Lite_ShowAllFonts()

    $lipsum = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? "
    $lipsumsrc = "de Finibus Bonorum et Malorum, written by Cicero in 45 BC"

    ; This example can be used both in the Lite version as well as a commercial version of the library.
    Local $sFileName = @ScriptDir & "\Example_ShowFonts.pdf"
    Local $oQP
    Local $iObjCreateResult = _QPDF_CreateObjectAndUnlock($oQP)
    If $iObjCreateResult = 1 Or $iObjCreateResult = 2 Then
        _QPDF_SetPageSize_Lite($oQP, 'A4') ; Landscape')
        $oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft) ;
        $oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)

;~ ; Parameters for AddStandardFont, SelectFont
;~ Const Enum _
;~      $__eQPDF_StandardFontID_Courier = 0, _          ; 0
;~      $__eQPDF_StandardFontID_CourierBold, _          ; 1
;~      $__eQPDF_StandardFontID_CourierBoldOblique, _   ; 2
;~      $__eQPDF_StandardFontID_CourierOblique, _       ; 3
;~      $__eQPDF_StandardFontID_Helvetica, _            ; 4
;~      $__eQPDF_StandardFontID_HelveticaBold, _        ; 5
;~      $__eQPDF_StandardFontID_HelveticaBoldOblique, _ ; 6
;~      $__eQPDF_StandardFontID_HelveticaOblique, _     ; 7
;~      $__eQPDF_StandardFontID_TimesRoman, _           ; 8
;~      $__eQPDF_StandardFontID_TimesBold, _            ; 9
;~      $__eQPDF_StandardFontID_TimesItalic, _          ; 10
;~      $__eQPDF_StandardFontID_TimesBoldItalic, _      ; 11
;~      $__eQPDF_StandardFontID_Symbol, _               ; 12
;~      $__eQPDF_StandardFontID_ZapfDingbats            ; 13

        _QPDF_AddStandardFont_Lite($oQP, 0) ; Courier
        $oQP.SetTextSize(10) ;
        ; a work around for drawing simple lines in LiteVersion
        ; http://www.debenu.com/docs/pdf_library_reference/DrawTextBox.php
        $oQP.SetTextUnderline(1)
        $oQP.DrawText(20, 20, _StringRepeat(Chr(160), 20))
        $oQP.DrawText(20, 20, "Hello world with Courier font underscore")
        $oQP.SetTextUnderline(0)
        $oQP.DrawText(20, 25, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 30, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 80, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 1) ; CourierBold
        $oQP.SetTextSize(10) ;
        ; a work around for drawing simple lines in LiteVersion
        ; http://www.debenu.com/docs/pdf_library_reference/DrawTextBox.php
        $oQP.SetTextUnderline(2)
        $oQP.DrawText(20, 90, _StringRepeat(Chr(160), 20))
        $oQP.DrawText(20, 90, "Hello world with CourierBold font, double underscore")
        $oQP.SetTextUnderline(0)
        $oQP.DrawText(20, 95, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 100, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 150, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 2) ; CourierBoldOblique
        $oQP.SetTextSize(10) ;
        ; a work around for drawing simple lines in LiteVersion
        ; http://www.debenu.com/docs/pdf_library_reference/DrawTextBox.php
        $oQP.SetTextUnderline(3)
        $oQP.DrawText(20, 160, _StringRepeat(Chr(160), 20))
        $oQP.DrawText(20, 160, "Hello world with CourierBoldOblique font, strike through")
        $oQP.SetTextUnderline(0)
        $oQP.DrawText(20, 165, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 170, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 220, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 3) ; CourierOblique
        $oQP.SetTextSize(10) ;
        ; a work around for drawing simple lines in LiteVersion
        ; http://www.debenu.com/docs/pdf_library_reference/DrawTextBox.php
        $oQP.SetTextUnderline(4)
        $oQP.DrawText(20, 230, _StringRepeat(Chr(160), 20))
        $oQP.DrawText(20, 230, "Hello world with CourierOblique font, overline")
        $oQP.SetTextUnderline(0)
        $oQP.DrawText(20, 235, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 240, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 290, $lipsumsrc)

        ; add new Page - second
        _QPDF_NewPage_Lite($oQP)

        _QPDF_AddStandardFont_Lite($oQP, 4) ; Helvetica
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 0)
        $oQP.DrawText(20, 20, "Hello world with Helvetica font, align left")
        $oQP.DrawText(20, 25, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 30, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 80, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 5) ; HelveticaBold
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 1)
        $oQP.DrawText(20, 90, "Hello world with HelveticaBold font, align center")
        $oQP.DrawText(20, 95, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 100, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 150, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 6) ; HelveticaBoldOblique
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 2)
        $oQP.DrawText(20, 160, "Hello world with HelveticaBoldOblique font, align right")
        $oQP.DrawText(20, 165, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 170, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 220, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 7) ; HelveticaOblique
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 3)
        $oQP.DrawText(20, 230, "Hello world with HelveticaOblique font, align justified")
        $oQP.DrawText(20, 235, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 240, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 290, $lipsumsrc)

        ; add new Page - second
        _QPDF_NewPage_Lite($oQP)

        _QPDF_AddStandardFont_Lite($oQP, 8) ; TimesRoman
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 4)
        $oQP.DrawText(20, 20, "Hello world with TimesRoman font, align force justified")
        $oQP.DrawText(20, 25, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 30, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 80, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 9) ; TimesBold
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 5)
        $oQP.DrawText(20, 90, "Hello world with TimesBold font, align last line justified")
        $oQP.DrawText(20, 95, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 100, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 150, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 10) ; TimesItalic
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 0)
        $oQP.DrawText(20, 160, "Hello world with TimesItalic font, align left (default)")
        $oQP.DrawText(20, 165, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 170, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 220, $lipsumsrc)

        _QPDF_AddStandardFont_Lite($oQP, 11) ; TimesBoldItalic
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 0)
        $oQP.DrawText(20, 230, "Hello world with TimesBoldItalic font, align left (default)")
        $oQP.DrawText(20, 235, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 240, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 290, $lipsumsrc)

        ; add new Page - second
        _QPDF_NewPage_Lite($oQP)

        _QPDF_AddStandardFont_Lite($oQP, 12) ; Symbol
        _QPDF_SelectFont_Lite($oQP, 12) ; Symbol
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 0)
        $oQP.DrawText(20, 20, "Hello world with Symbol font, align force justified")
        $oQP.DrawText(20, 25, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 30, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 80, $lipsumsrc)
        ; this does not work on Win7 Home Basic

        _QPDF_AddStandardFont_Lite($oQP, 13) ; ZapfDingbats
        $oQP.SetTextSize(10) ;
        _QPDF_SetTextAlign_Lite($oQP, 0)
        $oQP.DrawText(20, 90, "Hello world with ZapfDingbats font, align last line justified")
        $oQP.DrawText(20, 95, $lipsum) ; default text runs past right printable margin
        $oQP.DrawTextBox(20, 100, 180, 50, $lipsum, 1)
        $oQP.DrawText(20, 150, $lipsumsrc)

        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
    Else
        MsgBox(0, 'Error', _QPDF_UDF_ErrorDescription(@error, @extended))
        Return SetError(@error, @extended, '')
    EndIf

    $oQP = 0 ; CleanUp - destroy object
EndFunc   ;==>_QPDF_Example_Lite_ShowAllFonts

:)

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

I do have a question.  And I do not know how to implement.  I want to make text span multiple pages.

The main problem is that I do not know initially how long the text will be.  It may well fit a single line, or single page.  How to make it auto-span multiple pages?

Ideas? Advice?

Thx. Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Read in Debenu QPDF Reference about:
DrawHTMLTextBox

and try:
_QPDF_TXT_to_PDF
_QPDF_TXT_to_PDF_Lite
_QPDF_TXTFile_to_PDFFile

 

Edited by mLipok
typo

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

 

Func _QPDF_Example_Lite_TextMultiPagePDF()

    $lipsum = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? "
    $lipsum &= $lipsum
    $lipsum &= $lipsum
    $lipsum &= $lipsum
    $lipsumsrc = "de Finibus Bonorum et Malorum, written by Cicero in 45 BC"

Local $sFileName = @ScriptDir & "\Example_LongText.pdf"
    Local $oQP
    Local $iObjCreateResult = _QPDF_CreateObjectAndUnlock($oQP)
    If $iObjCreateResult = 1 Or $iObjCreateResult = 2 Then
        _QPDF_SetPageSize_Lite($oQP, 'A4') ; Landscape')
        $oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft) ;
        $oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)

        _QPDF_AddStandardFont_Lite($oQP, 0) ; Courier
        $oQP.SetTextSize(10) ;


     _QPDF_TXT_to_PDF_Lite($oQP, $lipsum)
;~      _QPDF_TXT_to_PDF($oQP, $lipsum)

Both these give the same kind of COM Error :(

 

>Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.8\QuickPDF v0.8\QuickPDF_Examples_LongText.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Start QuickPDF_Examples.au3
QuickPDF_Examples_LongText.au3 (3080) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3080
    err.retcode is:     0x00000000

This one created the LongTextTxt.txt file, but still returned the error and made an empty PDF.

Local $TextFile = @ScriptDir & "\LongTextTxt.txt"
Local $PDFFile = @ScriptDir & "\LongPDFFromText.pdf"

FileWrite($TextFile, $lipsum)

;_QPDF_TXTFile_to_PDFFile($sTxtFileFullPath, $sPDFFileFullPath)
_QPDF_TXTFile_to_PDFFile($TextFile, $PDFFile)

LongPDFFromText.pdf <<<<<<<<<<< my creation

Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.8\QuickPDF v0.8\QuickPDF_Examples_LongText.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Start QuickPDF_Examples.au3
QuickPDF_Examples_LongText.au3 (3080) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3080
    err.retcode is:     0x00000000

 

 

Also could not get this to work.  Idea was to write a line and then just keep on appending, but that does not work... :(

$oQP.AppendText($lipsum)

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Also, why do I get this?

_QPDF_AddStandardFont_Lite($oQP, 0) ; Courier
        $oQP.SetTextSize(10) ;

        Local $GetNumberofLines = $oQP.GetWrappedTextLineCount(180, $lipsum)
        ConsoleWrite("$GetNumberofLines " & $GetNumberofLines & @CRLF)

Returns

>Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.8\QuickPDF v0.8\QuickPDF_Examples_LongText.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Start QuickPDF_Examples.au3
QuickPDF_Examples_LongText.au3 (404) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  404
    err.retcode is:     0x00000000

$GetNumberofLines 
+>20:22:50 AutoIt3.exe ended.rc:0
+>20:22:50 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.297

Line 404 is this one: 

Local $GetNumberofLines = $oQP.GetWrappedTextLineCount(180, $lipsum)

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

GetWrappedTextLineCount

 

This function is avalaible only in commercial version, as far as I remember you are using LITE version ?

 

 

And in the following issue:

 

4 hours ago, Skysnake said:

This one created the LongTextTxt.txt file, but still returned the error and made an empty PDF.

Local $TextFile = @ScriptDir & "\LongTextTxt.txt"
Local $PDFFile = @ScriptDir & "\LongPDFFromText.pdf"

FileWrite($TextFile, $lipsum)

;_QPDF_TXTFile_to_PDFFile($sTxtFileFullPath, $sPDFFileFullPath)
_QPDF_TXTFile_to_PDFFile($TextFile, $PDFFile)

LongPDFFromText.pdf <<<<<<<<<<< my creation

Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoIt\DebenuPDF\QuickPDF v0.8\QuickPDF v0.8\QuickPDF_Examples_LongText.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Start QuickPDF_Examples.au3
QuickPDF_Examples_LongText.au3 (3080) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3080
    err.retcode is:     0x00000000

 

there is my fault as you are using:
_QPDF_TXTFile_to_PDFFile  >>> _QPDF_TXT_to_PDF  == _QPDF_TXT_to_PDF_Lite


but as I checked _QPDF_TXT_to_PDF  is using

SetHTMLNormalFont
SaveStyle
ApplyStyle

which are also not provided in LITE version  , my mistake sorry.

Try to change this function as in the following example:

Func _QPDF_TXT_to_PDF(ByRef $oQP, $sText, $iLeftMargin = 20, $iRighMargin = 10, $iTopMargin = 10, $iBottomMargin = 10, $iTABtoSpace = 4, $sStyle = Default)

    ; Replace @TAB to spaces.
    $sText = StringReplace($sText, @TAB, _StringRepeat(Chr(160), $iTABtoSpace))

    Local $iTextWidth = $__eQPDF_A4_WidthInMM - $iLeftMargin - $iRighMargin
    Local $iTextHeight = $__eQPDF_A4_HeightInMM - $iTopMargin - $iBottomMargin

    If $sStyle = Default Then
        _QPDF_SetDefaultCoordinates($oQP)
    ElseIf IsString($sStyle) And StringLen($sStyle) Then
        If $oQP.ApplyStyle($sStyle) = 0 Then
            Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, $QPDF_EXT_DEFAULT, 0)
        EndIf
    Else
        Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, $QPDF_EXT_DEFAULT, 0)
    EndIf

    Local $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sText)
    While $sOverFlowOutput
        $oQP.NewPage()
        If $sStyle = Default Then   
            _QPDF_SetDefaultCoordinates($oQP)
        Else
            $oQP.ApplyStyle($sStyle)
        EndIf
        $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sOverFlowOutput)
    WEnd
    Return SetError($QPDF_ERR_SUCCESS, $QPDF_EXT_DEFAULT, $oQP.PageCount())
EndFunc   ;==>_QPDF_TXT_to_PDF

 

and let me know about the results.

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Func _QPDF_TXT_to_PDF(ByRef $oQP, $sText, $iLeftMargin = 20, $iRighMargin = 10, $iTopMargin = 10, $iBottomMargin = 10, $iTABtoSpace = 4, $sStyle = Default)

    ; Replace @TAB to spaces.
    $sText = StringReplace($sText, @TAB, _StringRepeat(Chr(160), $iTABtoSpace))

    Local $iTextWidth = $__eQPDF_A4_WidthInMM - $iLeftMargin - $iRighMargin
    Local $iTextHeight = $__eQPDF_A4_HeightInMM - $iTopMargin - $iBottomMargin

    If $sStyle = Default Then
;~         _QPDF_SetDefaultCoordinates($oQP)
    ElseIf IsString($sStyle) And StringLen($sStyle) Then
        If $oQP.ApplyStyle($sStyle) = 0 Then
            Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, $QPDF_EXT_DEFAULT, 0)
        EndIf
    Else
        Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, $QPDF_EXT_DEFAULT, 0)
    EndIf

    Local $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sText)
    While $sOverFlowOutput
        $oQP.NewPage()
        If $sStyle = Default Then
;~             _QPDF_SetDefaultCoordinates($oQP)
        Else
            $oQP.ApplyStyle($sStyle)
        EndIf
        $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sOverFlowOutput)
    WEnd
;~     Return SetError($QPDF_ERR_SUCCESS, $QPDF_EXT_DEFAULT, $oQP.PageCount())
EndFunc   ;==>_QPDF_TXT_to_PDF

Console

Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF_Examples.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
QuickPDF_Examples.au3 (3089) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3089
    err.retcode is:     0x00000000

+>12:50:59 AutoIt3.exe ended.rc:0
+>12:50:59 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 5.319

If I do not comment those three lines I get this

>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF_Examples.au3
"C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF.au3"(3099,38) : warning: $QPDF_ERR_SUCCESS: possibly used before declaration.
    Return SetError($QPDF_ERR_SUCCESS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF.au3"(3099,38) : error: $QPDF_ERR_SUCCESS: undeclared global variable.
    Return SetError($QPDF_ERR_SUCCESS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF.au3"(3080,41) : error: _QPDF_SetDefaultCoordinates(): undefined function.
        _QPDF_SetDefaultCoordinates($oQP)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\AutoIt\PDF Debenu\QuickPDF v0.8\QuickPDF_Examples.au3 - 2 error(s), 1 warning(s)
!>12:53:15 AU3Check ended. Press F4 to jump to next error.rc:2
+>12:53:15 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 0.805

Yes, this is Lite and this is v0.8.  Is it possible to include that info in the error output?

Tested. v0.9 - same error

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\AutoIt\PDF Debenu\QuickPDF v0.9\QuickPDF_Examples.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
QuickPDF.au3 UDF:
QuickPDF_Examples.au3 (3317) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3317
    err.retcode is:     0x00000000

+>12:56:22 AutoIt3.exe ended.rc:0
+>12:56:22 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.851

Line 3317 is this

Local $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sText)

 

Thank you for all the help

 

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...