Hi all,
da es doch nicht so funktioniert, wie ich es mir vorgestellt hatte und ich sowieso schon wieder viel zu lange damit rumspiele, schreib ich jetz mal was
Ich möchte einen Screenshot eines Formular einer MS Access Datenbank machen und diesen in ein PDF einfügen.
Screenshot erzeugen, speichern und einfügen funktioniert auch, allerdings ist dann die Skalierung total im ***. Hab nun rausgefunden, dass wenn ich den Screenshot vorher um 90° drehe, dann einfüge und wieder zurückdrehe, die Skalierung einwandfrei ist. Gibts da nicht eine andere Möglichkeit?
Das Script bis jetzt:
Spoiler anzeigen
#include <date.au3>
#include <GDIPlus.au3>
#include <MPDF_UDF.au3>
#include <screencapture.au3>
WinActivate("PDF-Formular")
screencap()
Func screencap()
[/autoit] [autoit][/autoit] [autoit]If FileExists(@ScriptDir & "\Image2PDF.pdf") Then FileDelete(@ScriptDir & "\Image2PDF.pdf")
[/autoit] [autoit][/autoit] [autoit]$now = StringReplace(_Now(), ":", "_")
$now = StringReplace($now, ".", "_")
$now = StringReplace($now, " ", "_")
$now = StringReplace($now, ",", "_")
$rnd = Random(1, 9999, 1)
$var = @DesktopDir & "\Screens\DB_" & @UserName & "_" & $now & "_" & $rnd & ".jpg"
$pic = _ScreenCapture_Capture("")
_ScreenCapture_SaveImage($var, $pic)
;bild drehen
;~ _GDIPlus_Startup()
;~ $hImage = _GDIPlus_ImageLoadFromFile($var)
;~ $sCLSID = _GDIPlus_EncodersGetCLSID("JPG")
;~ $tData = DllStructCreate("int Data")
;~ DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
;~ $tParams = _GDIPlus_ParamInit(1)
;~ _GDIPlus_ParamAdd($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
;~ _GDIPlus_ImageSaveToFileEx($hImage, $var, $sCLSID, DllStructGetPtr($tParams))
;~ _GDIPlus_Shutdown()
;PDF erstellen
Local $aImgs = $var
;set the properties for the pdf
_SetTitle("Image2PDF")
_SetSubject("Convert image(s) to pdf")
_SetKeywords("pdf, AutoIt")
_OpenAfter(True);open after generation
_SetUnit($PDF_UNIT_CM)
_SetPaperSize("a3")
_SetZoomMode($PDF_ZOOM_CUSTOM, 90)
_SetOrientation($PDF_ORIENTATION_LANDSCAPE)
;~ _SetOrientation($PDF_ORIENTATION_PORTRAIT)
_SetLayoutMode($PDF_LAYOUT_DEFAULT)
;~ _SetLayoutMode($PDF_LAYOUT_CONTINOUS)
;initialize the pdf
_InitPDF(@ScriptDir & "\Image2PDF.pdf")
;=== load resources used in pdf ===
_LoadResImage("img", $aImgs)
;load each image on it's own page
_BeginPage()
;scale image to paper size!
;~ _InsertImage("img", 0, 0, _GetPageWidth(), _GetPageHeight())
_InsertImage("img", 0, 0, _GetPageWidth() / _GetUnit(), _GetPageHeight() / _GetUnit())
_EndPage()
;then, finally, write the buffer to disk
_ClosePDFFile()
;~ FileDelete($var)
EndFunc ;==>screencap
Wär super, wenn einer (oder zwei) etwas tolles wüssten
Danke & Gruß
x0r