Qwerty212 Posted November 18, 2019 Share Posted November 18, 2019 1 hour ago, faustf said: when i open a file tell me the number of the page is not valid or not exist in a page but when i close not ask me if i want save it Hi again, with the script above you get a non existing page error? What pdf reader are you using? Link to comment Share on other sites More sharing options...
faustf Posted November 18, 2019 Share Posted November 18, 2019 nitro pdf reader i modify a pdf i show you expandcollapse popupFunc _TxtPrint() ;set the properties for the pdf _SetTitle("Fattura") _SetSubject("Fattura di cortesia") _SetKeywords("pdf, Fattura") _OpenAfter(True) ;open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_CUSTOM, 90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\Fattura.pdf") ;_LoadFontTT("F1", $PDF_FONT_CALIBRI,$PDF_FONT_ITALIC) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) _SetColourFill(0x000000) _SetColourStrokE(0x000000) ;=== create objects that are used in multiple pages === _StartObject("Antet", $PDF_OBJECT_ALLPAGES) ;NOTFIRSTPAGE) _Draw_Rectangle(0.5, 25, 9.8, 4, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo di sinistra sede legale _DrawText(0.6, 28.6, "Cedente/prestatore (fornitore)", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(0.7, 28, "Identificativo fiscale ai fini IVA: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(0.7, 27.4, "Denominazione: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(0.7, 27, "Indirizzo: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(0.7, 26.6, "Comune: ", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere provincia _DrawText(0.7, 26.2, "Cap:", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(10.7, 25, 9.8, 4, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo di destra sede operativa _DrawText(10.8, 28.6, "Cessionario/committente (cliente)", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(10.9, 28, "Identificativo fiscale ai fini IVA: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(10.9, 27.4, "Denominazione: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(10.9, 27, "Indirizzo: ", "_Calibri", 9, $PDF_ALIGN_LEFT) _DrawText(10.9, 26.6, "Comune: ", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere provincia _DrawText(10.9, 26.2, "Cap:", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione ; _DrawText(1.3, 28.6, "Cedente/prestatore (fornitore)", "_Calibri", 9, $PDF_ALIGN_LEFT) ;_Draw_Rectangle(0.5, 23.3, 20, 1.5, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo ;------------------------------------------------------------------------------------------------------------------------------------ _Draw_Rectangle(0.5, 24.1, 6, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(2, 24.3, "Tipologia Documento", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 23.4, 6, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(2, 23.6, "variabile Documento", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(6.5, 24.1, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(7, 24.3, "ART. 73", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(6.5, 23.4, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(7, 23.6, "var 73", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 24.1, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(9.7, 24.3, "Numero documento", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 23.4, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(9.7, 23.6, "variabile num documento ", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(13.5, 24.1, 4, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.4, 24.3, "Data documento ", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(13.5, 23.4, 4, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.4, 23.6, " var Data documento ", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 24.1, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(18, 24.3, "Cod. Destinatario", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 23.4, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(18, 23.6, "var Codice Destinatario", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione ;------------------------------------ BODY INVOICE ----------------------------------------------------------------------------------------- _Draw_Rectangle(0.5, 22.5, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(1, 22.8, "Cod.Art.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 21.8, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(1, 22, "var 73", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(2.5, 22.5, 6, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(4.5, 22.8, "Descrizione", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(2.5, 21.8, 6, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(4.5, 22, "variabile Documento", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(8.5, 22.5, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(8.9, 22.8, "Quantita", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 21.8, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(8.9, 22, "variabile qtt", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(10.5, 22.5, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(10.8, 22.8, "prezzo unit.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(10.5, 21.8, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(10.8, 22, "variabile prez", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(12.5, 22.5, 1.5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(13, 22.8, "UM", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(12.5, 21.8, 1.5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(13, 22, "var UM", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(14, 22.5, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.5, 22.8, "Sconto", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(14, 21.8, 2, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.1, 22, "variabile prez", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(16, 22.5, 1.5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(16.5, 22.8, "IVA", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(16, 21.8, 1.5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(16.1, 22, "var UM", "_Calibri", 9, $PDF_ALIGN_LEFT) ; variabile documento _Draw_Rectangle(17.5, 22.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(17.9, 22.8, "Cod. Destinatario", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 21.1, 3, 1.4, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo y sposta di 0.7 alla volta e y allarga il doppio per incrementare le righe _DrawText(17.6, 22, "var Codice Destinatario", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _DrawText(17.6, 21.5, "var Codice Destinatario", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione ;_Draw_Rectangle(0.5, 23.3, 20, 0.9, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo ;------------------------------------------------------------------------------------------------------------------------------------ ;----------------------------------- RIEPILOGHI IVA E TOTALI ------------------------------------------------------------------------ _Draw_Rectangle(17.5, 1.2, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(17.8, 1.4, "Totale Documento", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 0.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(17.9, 0.8, "Var tot docu", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 2.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(17.9, 2.8, "Totale Imposta", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(17.5, 1.8, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(17.8, 2.0, "Var tot Impo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(14.5, 1.2, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.8, 1.4, "Totale Imponibile", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(14.5, 0.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.9, 0.8, "Var tot docu", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(14.5, 2.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.9, 2.8, "Totale Imposta", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(14.5, 1.8, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(14.8, 2.0, "Var tot Impo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(11.5, 1.2, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo ;_DrawText(11.8, 2.8, "Arr.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(11.5, 0.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(11.9, 0.8, "Var Arr", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(11.5, 2.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo _DrawText(11.9, 2.8, "", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(11.5, 1.8, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo ;_DrawText(11.8, 2.0, "Var Arr", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _DrawText(11.9, 2.8, "Arr.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 2.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 1 _DrawText(9, 2.8, "spese acc", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 1.8, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 2 _DrawText(8.8, 2.0, "Var tot Impo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 1.1, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 3 _DrawText(9, 1.4, "Sconto/Maggioraz.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(8.5, 0.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 4 _DrawText(8.9, 0.8, "Var tot docu", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(5.5, 2.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 1 _DrawText(6.8, 2.8, "IVA", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(5.5, 1.8, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 2 _DrawText(5.8, 2.0, "Var tot Impo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(5.5, 1.1, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 3 ; _DrawText(5.8, 1.4, "Sconto/Maggioraz.", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(5.5, 0.5, 3, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 4 _DrawText(5.8, 0.8, "Var tot docu", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 2.5, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 1 _DrawText(1.5, 2.8, "egesibilit./rif. normativo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 1.8, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 2 _DrawText(2, 2.0, "Var tot Impo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 1.1, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 3 _DrawText(2, 1.4, "Importo Bollo", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione _Draw_Rectangle(0.5, 0.5, 5, 0.7, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.05) ; rettangolo 4 _DrawText(2, 0.8, "Var tot docu", "_Calibri", 9, $PDF_ALIGN_LEFT) ; da mettere nazione ;---------------------------------------------------------------------------------------------------------------------------------------- #cs _SetTextHorizontalScaling(90) ;and begin writting some data _DrawText(5.2, 27.6, StringUpper("Et adipiscing nec nisi elementum natoque!"), "_Garamond", 14, $PDF_ALIGN_LEFT) _DrawText(5.2, 26.9, StringUpper("Dapibus scelerisque vel rhoncus porttitor!"), "_Garamond", 16, $PDF_ALIGN_LEFT) _SetTextHorizontalScaling(80) _DrawText(5.2, 26.2, "Dapibus scelerisque vel rhoncus porttitor!", "_TimesT", 12, $PDF_ALIGN_LEFT) _DrawText(5.2, 25.6, "Rhoncus a vut natoque pellentesque", "_TimesT", 12, $PDF_ALIGN_LEFT) _DrawText(5.2, 25, "taietel@yahoo.com" & "; " & "http://autoitscript.com/forum/topic/118827-create-pdf-from-your-application/", "_TimesT", 11, $PDF_ALIGN_LEFT) ;get the scalling back to default value _SetTextHorizontalScaling(100) ;and colour also _SetColourFill(0) ;that's the end of our header! #ce _EndObject() _BeginPage() ;that's the end of our header! ;_Draw_Rectangle(7, 25.5, 0, 4, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.01) _EndPage() ;write the buffer to disk _ClosePDFFile() EndFunc ;==>_TxtPrint Link to comment Share on other sites More sharing options...
Qwerty212 Posted November 18, 2019 Share Posted November 18, 2019 I have tested your example with Sumatrapdf reader and with Acrobat pdf reader and they both work fine with your pdf: I have also opened it with Safari and PDF Element in a MacOS Mojave and it works just fine. So I guess that there should be a problem with nitropdf as this user reported time ago faustf 1 Link to comment Share on other sites More sharing options...
faustf Posted November 18, 2019 Share Posted November 18, 2019 onic i will change reader thanks so much Link to comment Share on other sites More sharing options...
Qwerty212 Posted November 18, 2019 Share Posted November 18, 2019 12 minutes ago, faustf said: onic i will change reader thanks so much Sorry, I'd liked to help some more. Greets from Barcelona Link to comment Share on other sites More sharing options...
faustf Posted November 18, 2019 Share Posted November 18, 2019 we can build a prog for create pdf layout like a paint ... but not now soon i sure ask some help thankz again Link to comment Share on other sites More sharing options...
konya Posted July 17, 2020 Share Posted July 17, 2020 When I setting windows system UI language to 1028 (0x404) create image to pdf it is fail, change windows system UI language to 1033(0x409) create image to pdf it is correct, who can help resolve this issue. Link to comment Share on other sites More sharing options...
wimhek Posted October 8, 2022 Share Posted October 8, 2022 Hi there, Is it possible to create an index /table of content within the PDF document ? Thank You Link to comment Share on other sites More sharing options...
Qwerty212 Posted October 8, 2022 Share Posted October 8, 2022 4 hours ago, wimhek said: Hi there, Is it possible to create an index /table of content within the PDF document ? Thank You Hi wimhek. This udf creates the pdf concatenating a string following the pdf standard (more info here: https://www.oreilly.com/library/view/pdf-explained/9781449321581/ch04.html) I tried to include hyperlinks to the current udf (didn't accomplished, sorry). The problem with the index/table is that you should create it after the rest of the elements in the pdf, so it would mean to change the way the whole udf works. Link to comment Share on other sites More sharing options...
taietel Posted March 15, 2023 Author Share Posted March 15, 2023 On 10/8/2022 at 9:18 PM, Qwerty212 said: I tried to include hyperlinks to the current udf (didn't accomplished, sorry). Try this, see if it works: #include "..\MPDF_UDF.au3" #include <File.au3> ;set the properties for the pdf _SetTitle("Link to web example") _SetSubject("click link in pdf") _SetKeywords("pdf, AutoIt") _OpenAfter(True) ;open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_CUSTOM, 90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\link_in_pdf") _LoadFontTT("fontArial", $PDF_FONT_ARIAL, $PDF_FONT_ITALIC) _BeginPage() _InsertLink(2, 28, "https://autoitscript.com/", "fontArial", 10) _EndPage() ;write the buffer to disk _ClosePDFFile() Func _InsertLink($iX, $iY, $sURL, $sFontAlias, $iFontSize) __InitObj() _DrawText($iX, $iY, $sURL, $sFontAlias, $iFontSize) __EndObj() __InitObj() __ToBuffer("<</URI(" & __ToPdfStr($sURL) & ") /Type /Action /S /URI>>") __EndObj() EndFunc ;==>_InsertLink Zedna and Qwerty212 2 Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
Qwerty212 Posted March 15, 2023 Share Posted March 15, 2023 23 minutes ago, taietel said: Try this, see if it works: #include "..\MPDF_UDF.au3" #include <File.au3> ;set the properties for the pdf _SetTitle("Link to web example") _SetSubject("click link in pdf") _SetKeywords("pdf, AutoIt") _OpenAfter(True) ;open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_CUSTOM, 90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\link_in_pdf") _LoadFontTT("fontArial", $PDF_FONT_ARIAL, $PDF_FONT_ITALIC) _BeginPage() _InsertLink(2, 28, "https://autoitscript.com/", "fontArial", 10) _EndPage() ;write the buffer to disk _ClosePDFFile() Func _InsertLink($iX, $iY, $sURL, $sFontAlias, $iFontSize) __InitObj() _DrawText($iX, $iY, $sURL, $sFontAlias, $iFontSize) __EndObj() __InitObj() __ToBuffer("<</URI(" & __ToPdfStr($sURL) & ") /Type /Action /S /URI>>") __EndObj() EndFunc ;==>_InsertLink Impressive. It works like a charm. This udf is almost 13 years old and it's probably one of the ones that I've used the most. Thanks a lot. Greets from Barcelona Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now