roby Posted February 23, 2008 Share Posted February 23, 2008 Hello, I must write a script (autoit) to generate by program a pdf file, without dll or other... Fpdf class, for php, is an example of my idea. Has Smbody any example? Thank you Roby Link to comment Share on other sites More sharing options...
ReFran Posted February 23, 2008 Share Posted February 23, 2008 Hello,I must write a script (autoit) to generate by program a pdf file, without dll or other...Fpdf class, for php, is an example of my idea.Has Smbody any example?Thank youRobySomeone published a _StringToPdf UDF. Also if it's very simple, maybe a good startup.You may search for it.HTH, Reinhard Link to comment Share on other sites More sharing options...
roby Posted February 23, 2008 Author Share Posted February 23, 2008 Someone published a _StringToPdf UDF. Also if it's very simple, maybe a good startup.You may search for it.HTH, Reinhardthank you, I see it.. Link to comment Share on other sites More sharing options...
roby Posted February 23, 2008 Author Share Posted February 23, 2008 (edited) ok... but I don't find the technical reference of PDF file. Where I find it? Thank you Edited February 23, 2008 by roby Link to comment Share on other sites More sharing options...
ptrex Posted February 23, 2008 Share Posted February 23, 2008 @all Maybe this can get you started expandcollapse popup#include <GUIConstants.au3> GUICreate("PDF-Creator",500,520) GUICtrlCreateGroup("Seitenformat",10,30,170,70) GUICtrlCreateGroup("Rand (mm)",190,30,105,70) GUICtrlCreateGroup("Schriftformat",315,30,175,70) GUICtrlCreateRadio("Querformat",20,70) GUICtrlCreateLabel("Autor:",10,475,100,20) GUICtrlCreateLabel("Titel:",120,475,100,20) GUICtrlCreateLabel("links:",200,50,30,20) GUICtrlCreateLabel("oben:",200,75,30,20) $Start = GUICtrlCreateButton("erzeuge PDF",370,480,120,30) GUICtrlSetFont(-1,11,600) $Autor = GUICtrlCreateInput("",10,490,100,20) $Titel = GUICtrlCreateInput("",120,490,100,20) $Text = GUICtrlCreateEdit("Bitte geben sie hier Ihren Text ein.",10,120,480,345) $Schrift = GUICtrlCreateCombo("8",325,48,45,20) GUICtrlSetData(-1,"9|10|11|12|14|16|18|20|22|24|26|28|36|48|72","12") $Schriftart = GUICtrlCreateCombo("Times-Roman",380,48,100,20) GUICtrlSetData(-1,"Helvetica|Courier","Times-Roman") $Size = GUICtrlCreateCombo("A4",110,60,50,20) GUICtrlSetData(-1,"A3","A4") $Format = GUICtrlCreateRadio("Hochformat",20,50) GUICtrlSetState(-1,$GUI_CHECKED) $Rand_y = GUICtrlCreateInput("24",240,48,45,20) GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1,999,0) $Rand_x = GUICtrlCreateInput("25",240,72,45,20) GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1,999,0) $Fett = GUICtrlCreateCheckbox("Fett",325,73,35,20) $Kursiv = GUICtrlCreateCheckbox("Kursiv",370,73,60,20) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $Start Then ExitLoop WEnd $Pfad = FileSaveDialog("Speichern",@DesktopDir,"PDF (*.pdf)",16) If StringRight($Pfad,4) = ".pdf" Then Else $Pfad = $Pfad & ".pdf" EndIf $Fett = GUICtrlRead($Fett) $Kursiv = GUICtrlRead($Kursiv) $Schriftart = GUICtrlRead($Schriftart) $Rand_x = GUICtrlRead($Rand_x) $Rand_y = GUICtrlRead($Rand_y) $Format = GUICtrlRead($Format) $Autor = GUICtrlRead($Autor) $Titel = GUICtrlRead($Titel) $Size = GUICtrlRead($Size) $Text = GUICtrlRead($Text) $Schrift = GUICtrlRead($Schrift) FileDelete($Pfad) $File = FileOpen($Pfad, 1) $Zeilen = 1 If $Size = "A4" Then $Size_x = 210 $Size_y = 297 ElseIf $Size = "A3" Then $Size_x = 297 $Size_y = 420 EndIf If $Fett = $GUI_CHECKED Or $Kursiv = $GUI_CHECKED Then If $Schriftart = "Times-Roman" Then If $Fett = $GUI_CHECKED Then $Schriftart = "Times-Bold" ElseIf $Kursiv = $GUI_CHECKED Then $Schriftart = "Times-Italic" EndIf If $Fett = $GUI_CHECKED And $Kursiv = $GUI_CHECKED Then $Schriftart = "Times-BoldItalic" ElseIf $Schriftart = "Helvetica" Then If $Fett = $GUI_CHECKED Then $Schriftart = "Helvetica-Bold" ElseIf $Kursiv = $GUI_CHECKED Then $Schriftart = "Helvetica-Oblique" EndIf If $Fett = $GUI_CHECKED And $Kursiv = $GUI_CHECKED Then $Schriftart = "Helvetica-BoldOblique" Else If $Fett = $GUI_CHECKED Then $Schriftart = "Courier-Bold" ElseIf $Kursiv = $GUI_CHECKED Then $Schriftart = "Courier-Oblique" EndIf If $Fett = $GUI_CHECKED And $Kursiv = $GUI_CHECKED Then $Schriftart = "Courier-BoldOblique" EndIf EndIf If $Format = $GUI_UNCHECKED Then $Size = $Size_x $Size_x = $Size_y $Size_y = $Size EndIf If $Schrift = 8 Then $Abstand = 9 ElseIf $Schrift = 9 Then $Abstand = 11 ElseIf $Schrift = 10 Then $Abstand = 12 ElseIf $Schrift = 11 Then $Abstand = 13 ElseIf $Schrift = 12 Then $Abstand = 15 ElseIf $Schrift = 14 Then $Abstand = 17 ElseIf $Schrift = 16 Then $Abstand = 19 ElseIf $Schrift = 18 Then $Abstand = 21 ElseIf $Schrift = 20 Then $Abstand = 24 ElseIf $Schrift = 22 Then $Abstand = 26 ElseIf $Schrift = 24 Then $Abstand = 28 ElseIf $Schrift = 26 Then $Abstand = 30 ElseIf $Schrift = 28 Then $Abstand = 32 ElseIf $Schrift = 36 Then $Abstand = 41 ElseIf $Schrift = 48 Then $Abstand = 55 Else $Abstand = 83 EndIf If Not StringInStr($Text,@CRLF) = 0 Then $Text = StringSplit($Text,@CRLF) $Zeilen = $Text[0] / 2 + 1 EndIf ; Umrechnung $Wert = 2.834175 $Size_y = Round($Size_y * $Wert) $Size_x = Round($Size_x * $Wert) $Rand_x = Round($Rand_x * $Wert) $Rand_y = Round($Rand_y * $Wert) FileWriteLine($File,"%PDF-1.2") FileWriteLine($File,"%âãÏÓ") FileWriteLine($File,"1 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Author ("&$Autor&")") FileWriteLine($File,"/CreationDate (D:"&@YEAR&@MON&@MDAY&@HOUR&@MIN&@SEC&")") FileWriteLine($File,"/Creator (Ahnungslos)") FileWriteLine($File,"/Producer (Ahnungslos)") FileWriteLine($File,"/Title ("&$Titel&")") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"4 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Font") FileWriteLine($File,"/Subtype /Type1") FileWriteLine($File,"/Name /F1") FileWriteLine($File,"/Encoding 5 0 R") FileWriteLine($File,"/BaseFont /"&$Schriftart) FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"5 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Encoding") FileWriteLine($File,"/BaseEncoding /WinAnsiEncoding") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"6 0 obj") FileWriteLine($File,"<<") FileWriteLine($File," /Font << /F1 4 0 R >>") FileWriteLine($File," /ProcSet [ /PDF /Text ]") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"7 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Page") FileWriteLine($File,"/Parent 3 0 R") FileWriteLine($File,"/Resources 6 0 R") FileWriteLine($File,"/Contents 8 0 R") FileWriteLine($File,"/Rotate 0") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"8 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Length 9 0 R") FileWriteLine($File,">>") FileWriteLine($File,"stream") FileWriteLine($File,"BT") If $Zeilen = 1 Then FileWriteLine($File,"/F1 "&$Schrift&" Tf") FileWriteLine($File,"1 0 0 1 "&$Rand_y&" "&$Size_y - $Rand_x - $Abstand&" Tm") FileWriteLine($File,"("&$Text&") Tj") Else For $Counter = 1 To $Zeilen FileWriteLine($File,"/F1 "&$Schrift&" Tf") FileWriteLine($File,"1 0 0 1 "&$Rand_y&" "&$Size_y - $Rand_x - $Abstand * $Counter&" Tm") FileWriteLine($File,"("&$Text[$Counter * 2 - 1]&") Tj") Next EndIf FileWriteLine($File,"ET") FileWriteLine($File,"endstream") FileWriteLine($File,"endobj") FileWriteLine($File,"9 0 obj") FileWriteLine($File,"78") FileWriteLine($File,"endobj") FileWriteLine($File,"2 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Catalog") FileWriteLine($File,"/Pages 3 0 R") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"3 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Pages") FileWriteLine($File,"/Count 1") FileWriteLine($File,"/MediaBox [ 0 0 "&$Size_x&" "&$Size_y&" ]") FileWriteLine($File,"/Kids [ 7 0 R ]") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"0 10") FileWriteLine($File,"0000000000 65535 f ") FileWriteLine($File,"0000000013 00000 n ") FileWriteLine($File,"0000000591 00000 n ") FileWriteLine($File,"0000000634 00000 n ") FileWriteLine($File,"0000000156 00000 n ") FileWriteLine($File,"0000000245 00000 n ") FileWriteLine($File,"0000000307 00000 n ") FileWriteLine($File,"0000000372 00000 n ") FileWriteLine($File,"0000000453 00000 n ") FileWriteLine($File,"0000000576 00000 n ") FileWriteLine($File,"trailer") FileWriteLine($File,"<<") FileWriteLine($File,"/Size 10") FileWriteLine($File,"/Root 2 0 R") FileWriteLine($File,"/Info 1 0 R") FileWriteLine($File,">>") FileWriteLine($File,"startxref") FileWriteLine($File,"712") FileWriteLine($File,"%%EOF") FileClose($File) Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ReFran Posted February 23, 2008 Share Posted February 23, 2008 (edited) Works good. It never comes me into my mind to try something like that.To much free PDF Writer on the market.But I think I can good use it for a small application I just work on.ThanksHowever,the Acrobat SDK with PDF specification you find at: http://www.adobe.com/devnet/acrobat/for a quick start the direct link: http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdfHTH, ReinhardPS: They complicated it a little bit (15,8MB) compared to "ptrex - definition" Edited February 23, 2008 by ReFran Link to comment Share on other sites More sharing options...
roby Posted February 24, 2008 Author Share Posted February 24, 2008 well, have you a function to draw a line? I try ... FileWriteLine($File, "150 250 m") FileWriteLine($File, "150 350 l") FileWriteLine($File, "S") ... but don't work... Thank you Link to comment Share on other sites More sharing options...
ReFran Posted February 24, 2008 Share Posted February 24, 2008 well, have you a function to draw a line? I try ... FileWriteLine($File, "150 250 m") FileWriteLine($File, "150 350 l") FileWriteLine($File, "S") ... but don't work... Thank you As you know - from the 15,8MB PDF-Reference file - a pdf has a well defined structure. So where in the file did you write? br, Reinhard 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