Emiel Wieldraaijer Posted October 17, 2014 Share Posted October 17, 2014 (edited) @SDothard, I believe you want to add an existing PDF as background if so than you have to convert the PDF into a JPG and do the following _LoadResImage ("Background", "Background.jpg") _BeginPage() _InsertImage("Background", 0, 0, _GetPageWidth() / _GetUnit(), _GetPageHeight() / _GetUnit()) Edited October 17, 2014 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
vicmandev Posted March 30, 2015 Share Posted March 30, 2015 Allowing accented characters Change in MPDF_UDF.au3 v1.0.3 expandcollapse popupFunc _LoadFontTT($sAlias, $BaseFont, $sOptions = $PDF_FONT_NORMAL) Local $sTemp = "" $_Font = $_Font + 1 $BaseFont = StringReplace($BaseFont, " ", "") Switch $BaseFont Case "TimesNewRoman" __FontTimes($sOptions) Case "CourierNew" __FontCourier($sOptions) Case "Symbol" __FontSymbol($sOptions) Case "Calibri" __FontCalibri($sOptions) Case "Garamond" __FontGaramond($sOptions) Case Else __FontArial($sOptions) EndSwitch Local $i = __InitObj() __ToBuffer("<< /Type/Font/Subtype/TrueType/Name/" & $sAlias & "/BaseFont/" & $BaseFont & $sOptions & "/FirstChar " & $FirstChar & "/LastChar " & $LastChar & "/FontDescriptor " & $i + 1 & " 0 R/Encoding/WinAnsiEncoding/Widths [") For $j = $FirstChar To $LastChar If $Widths[$j - $FirstChar] <> 0 Then $sTemp &= __ToStr($Widths[$j - $FirstChar]) & " " If Mod($j - $FirstChar + 1, 16) = 0 Or $j = $LastChar Then __ToBuffer($sTemp) $sTemp = "" EndIf EndIf Next __ToBuffer("] >>") __EndObj() $_sFONT = $_sFONT & "/" & $sAlias & " " & $i & " 0 R " & @CRLF $_sFONTNAME = $_sFONTNAME & "<" & $sAlias & ">" & StringRight("0000" & $_Font, 4) & ";" ;$i = __InitObj() __ToBuffer("<< /Type/FontDescriptor/FontName/" & $BaseFont & $Param & ">>") __EndObj() EndFunc ;==>_LoadFontTT To expandcollapse popupFunc _LoadFontTT($sAlias, $BaseFont, $sOptions = $PDF_FONT_NORMAL) Local $sTemp = "" $_Font = $_Font + 1 $BaseFont = StringReplace($BaseFont, " ", "") Switch $BaseFont Case "TimesNewRoman" __FontTimes($sOptions) Case "CourierNew" __FontCourier($sOptions) Case "Symbol" __FontSymbol($sOptions) Case "Calibri" __FontCalibri($sOptions) Case "Garamond" __FontGaramond($sOptions) Case Else __FontArial($sOptions) EndSwitch Local $i = __InitObj() __ToBuffer("<< /Type/Font/Subtype/TrueType/Name/" & $sAlias & "/BaseFont/" & $BaseFont & $sOptions & "/FirstChar " & $FirstChar & "/LastChar " & $LastChar & "/FontDescriptor " & $i + 1 & " 0 R/Encoding/WinAnsiEncoding/Widths [") For $j = $FirstChar To $LastChar ; VMA, para que acepte cualquier caracter If $Widths[$j] <> 0 Then $sTemp &= __ToStr($Widths[$j]) & " " If Mod($j - $FirstChar + 1, 16) = 0 Or $j = $LastChar Then __ToBuffer($sTemp) $sTemp = "" EndIf EndIf #cs If $Widths[$j - $FirstChar] <> 0 Then $sTemp &= __ToStr($Widths[$j - $FirstChar]) & " " If Mod($j - $FirstChar + 1, 16) = 0 Or $j = $LastChar Then __ToBuffer($sTemp) $sTemp = "" EndIf EndIf #ce Next __ToBuffer("] >>") __EndObj() $_sFONT = $_sFONT & "/" & $sAlias & " " & $i & " 0 R " & @CRLF $_sFONTNAME = $_sFONTNAME & "<" & $sAlias & ">" & StringRight("0000" & $_Font, 4) & ";" ;$i = __InitObj() __ToBuffer("<< /Type/FontDescriptor/FontName/" & $BaseFont & $Param & ">>") __EndObj() EndFunc ;==>_LoadFontTT Zedna 1 Link to comment Share on other sites More sharing options...
ElTiburon Posted December 10, 2015 Share Posted December 10, 2015 If you look to output PDF's from your application (generate reports, graphics, tables etc), this UDF can be very useful. In the zip file are examples, images for testing and the UDF. Enjoy! I have removed some of the previous versions due to the lack of space, but they are still available on request.  [uPDATED June 22] v.1.0.1 Added more page formats, two more fonts, example table ... [uPDATED July 30] v1.0.2 Solved issues with Adobe Reader. StuffByDennis added two more functions (Thanks Dennis). [uPDATED August 10] v1.0.3 Rewrote entirely _LoadResImage function - optimize for speed/size of the pdf. Fixed the Example_Image2PDFThanks to xavierh for finding a missing space in the _LoadFontTT function (even it looks insignificant, that solvedan issue with text justification when using Adobe Reader, not Foxit Reader) Total downloads old versions: 2044 + 21 Version 1.0.3: MPDFv103.zip  Hidden Content Hi all,after I updated AutoIt to the latest version 2 functions not working anymore:; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetTextLength ; Description ...: Get the length of a string ; Syntax ........: _GetTextLength( $sText , $sFontAlias , $iFontSize ) ; Parameters ....: $sText - string value. ; $sFontAlias - string value. ; $iFontSize - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/118827-create-pdf-from-your-application/ ; Example .......: No ; =============================================================================================================================== Func _GetTextLength($sText, $sFontAlias, $iFontSize) Local $k = StringInStr($_sFONTNAME, "<" & $sFontAlias & ">") Local $C Local $l = StringLen($sText) Local $j = 0 If $k > 0 Then $k += StringLen($sFontAlias) + 2 For $i = 1 To $l $C = Asc(StringMid($sText, $i, 1)) $k += _Iif(($C >= $FirstChar) And ($C <= $LastChar), $Widths[$C], $MissingWidth) If $C = 32 Then $j += 1 Next EndIf Return __ToUser((($k * $iFontSize / 1000) + ($j * $_WordSpacing) + ($l * $_CharSpacing)) * ($_TextScaling / 100)) EndFunc ;==>_GetTextLengthexpandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _ClosePDFFile ; Description ...: Write the buffer to the pdf ; Syntax ........: _ClosePDFFile( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: _InitPDF() ; Link ..........: http://www.autoitscript.com/forum/topic/118827-create-pdf-from-your-application/ ; Example .......: No ; =============================================================================================================================== Func _ClosePDFFile() $_iResource = __InitObj(4) __ToBuffer("<<" & _ _Iif($_sFONT <> "", "/Font<<" & $_sFONT & ">>", "") & _ "/ProcSet [/PDF/Text" & _Iif($_Image <> "", "/ImageB/ImageC/ImageI", "") & "]" & _ _Iif(($_Image <> "") Or ($_sObject <> ""), "/XObject <<" & $_Image & $_sObject & ">>", "") & ">>") __EndObj() $_iPages = __InitObj(3) __ToBuffer("<</Type /Pages /Count " & $_Pages & " /MediaBox [0 0 " & __ToStr($_PageWidth,1) & " " & __ToStr($_PageHeight,1) & "] " & _ "/CropBox [" & __ToStr($__SetMargin) & " " & __ToStr($__SetMargin) & " " & __ToStr($_PageWidth - $__SetMargin,1) & " " & __ToStr($_PageHeight - $__SetMargin,1) & "] " & _ _Iif($_Orientation = $PDF_ORIENTATION_LANDSCAPE, "/Rotate -90", "") & "/Kids [" & $_sPage & "] " & "/Resources " & $_iResource & " 0 R>>") __EndObj() __ToBuffer("xref") __ToBuffer("0 " & $_iMaxObject+1) __ToBuffer("0000000000 65535 f") For $i = 1 To $_iMaxObject __ToBuffer($aXREF[$i]) Next __ToBuffer("trailer" & @CRLF & _ "<< /Size " & $_iMaxObject + 1 & "/Info 1 0 R" & "/Root 2 0 R" & ">>") __ToBuffer("startxref" & @CRLF & StringLen("startxref" & @CRLF & $_Buffer & "%%EOF" & @CRLF) + 6) $_FileName = FileOpen($PDF_NAME,18) FileWrite($_FileName, $_Buffer & "%%EOF" & @CRLF) FileClose($_FileName) $_Pages = "" $_sPage = "" $_sFONT = "" $_Image = "" $_sObject = "" $_iResource = "" $_Buffer = "" If $_bOpen Then ShellExecute($PDF_NAME) EndFunc ;==>_ClosePDFFileThe Error is: "error: _Iif(): undefined function."Please can anybody help me?Thank all who takes the time to help meWith best regardsElTiburon Link to comment Share on other sites More sharing options...
Qwerty212 Posted January 6, 2016 Share Posted January 6, 2016 @Eltiburon: Add this to the end of your MPDF_UDF.au3Func _Iif($vExpression, $vTrue, $vFalse) Return $vExpression ? $vTrue : $vFalse EndFunc ;==>_Iif One question:I want to use this two symbols in my PDFs: ↑ and ↓ but using an standard font, no the symbols one (because they are going to be part of a sentence).In the PDF they are showed as "?". I'm using the udf to fill some work documentation and in need to write inside a given space in a paper, so I chck the lenght of the text and I do reduce the font size until it fits:Local $fontsize = 13 Local $description = $Manolo[2] Local $textsize = _GetTextLength(String($description), "_Calibri", $fontsize) If $textsize > 9.5 Then Do Local $textsize = _GetTextLength(String($description), "_Calibri", $tamanofuente) $fontsize = $fontsize - 0.1 Until $textsize < 9.5 EndIf _DrawText(6.6 + $margenizq, 7.2 - $diff + $margensup, $description, "_Calibri", $fontsize, $PDF_ALIGN_LEFT, 0) EndIfBut as I need to use (sometimes) the up and down arrows, I guess that it would be pian in the ass get the position of the arrow inside an string. Change that arrow for a blank space. Calculate the position where it should be drawed in the paper with the _GetTextLenght function and then draw an arrow instead of writting it directly.Other symbols like Ă˜ and the µ are recognized fine and writted fine with every font correctly. Maybe is there a way of adding the arrows to the standard fonts?Greets from Barcelona Link to comment Share on other sites More sharing options...
error471 Posted February 6, 2016 Share Posted February 6, 2016 (edited) Hey, this UDF is awesome, but I have problem, that I could not handle so far. I want to output some data out of an array into a table on a A4 paper. The array size varies (3 to 10 columns and 2 to XX rows). The table has always a different position. I tried different values, but without success. The table seems to be set from the low-left corner, instead of the left-up corner, which needs calculations of the table size and some "centering"-code, which I tried. Maybe someone can explain. Best Wishes error471 Edited February 6, 2016 by error471 Link to comment Share on other sites More sharing options...
error471 Posted February 6, 2016 Share Posted February 6, 2016 (edited) Ok guys, I could help myself with that line: _InsertTable(2,Round(_GetPageHeight()/_GetUnit(),1)-4.7-$tNumberOfRows*0.5,0,$tNumberOfRows*0.5,$tNumberofColums,$tNumberOfRows) It calculates pageheight-tableheight-4.7. The last -4.7 is the distance tha I prefer to the top. But I have another issue. The width of the table is automatically set, when it is $iW = 0. Unfortunately the automatic modus is not perfect. Longer content is consequently cut. Is there a way to set one column - for example the first - and the rest automtically? Edited February 6, 2016 by error471 Link to comment Share on other sites More sharing options...
KeshHERE Posted September 17, 2016 Share Posted September 17, 2016 Just in case if anyone is having this problem  Line 824 ("MPDF_UDF.au3"): $k += _Iif(($C >= $FirstChar) And ($C <= $LastChar), $Widths[$C], $MissingWidth) $k += ^ERROR Error: Unknown function name.  then add this piece of code at the end of MPDF_UDF.au3 file Func _Iif($fTest, $vTrueVal, $vFalseVal) If $fTest Then Return $vTrueVal Else Return $vFalseVal EndIf EndFunc   Link to comment Share on other sites More sharing options...
dmob Posted September 17, 2016 Share Posted September 17, 2016 2 hours ago, KeshHERE said:  Func _Iif($fTest, $vTrueVal, $vFalseVal) If $fTest Then Return $vTrueVal Else Return $vFalseVal EndIf EndFunc   Or, Func _Iif($fTest, $vTrueVal, $vFalseVal) Return $fTest ? $vTrueVal : $vFalseVal EndFunc  coffeeturtle 1 Link to comment Share on other sites More sharing options...
Zedna Posted November 10, 2016 Share Posted November 10, 2016 (edited) 1) I tried fix by vicmandev for accented characters but unfortunatelly it still doesn't work and some Czech accented characters are still cripled (the same as before fix). Note: Czech characters inside PDF file viewed by file viewer are OK so it must be problem with declaration of font inside PDF. 2) All generated PDF files are somehow internally incorrect because in Adobe Acrobat Reader (version XI) it always before closing PDF file (after successful opening) asks "Do you want to save changes before closing file?" So I think that maybe some PDF tag <> generated by this UDF is not correctly closed ... EDIT: Generated PDF file introducing both problems is attached Example_Table2.pdf Edited November 10, 2016 by Zedna attached PDF file Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
MattHiggs Posted November 21, 2016 Share Posted November 21, 2016 "C:\Users\whiggs\Desktop\MPDFv103\MPDF_UDF.au3"(251,54) : error: _Iif(): undefined function. Â Â Â Â Â Â Â Â Â _Iif($_sFONT <> "", "/Font<<" & $_sFONT & ">>", "") Â Â When I try to run one of the examples Link to comment Share on other sites More sharing options...
mLipok Posted November 21, 2016 Share Posted November 21, 2016 Please check last few post in this thread. 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 Code * for 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 API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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"  , 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 More sharing options...
ggraziano2005 Posted May 15, 2017 Share Posted May 15, 2017 Is there any way to write the page number on each page in the format "page x of y"? Link to comment Share on other sites More sharing options...
DaLiMan Posted May 29, 2017 Share Posted May 29, 2017 Hi taietel, thanx for this amazing UDF! I'm currently playing with it to see if I can use it for an idea I have. But I need help to figure out how to align soms text to the right of the page. I need an adres to be places at the right side of the page. Can you help me with a little example on how to do this? Â I tried this, but it does not work the way I expected. This shows the text inline like [Street 51234DL Someplace 06-12345678] Â Dim $AdresTxt = "Street 5" & @CRLF & "1234DL Someplace" & @CRLF & "06-12345678" _DrawText(4, 16, $AdresTxt, "_Garamond", 8, $PDF_ALIGN_RIGHT) Â Link to comment Share on other sites More sharing options...
dmob Posted May 31, 2017 Share Posted May 31, 2017 On 5/29/2017 at 7:41 PM, DaLiMan said: I tried this, but it does not work the way I expected. This shows the text inline like [Street 51234DL Someplace 06-12345678]  Dim $AdresTxt = "Street 5" & @CRLF & "1234DL Someplace" & @CRLF & "06-12345678" _DrawText(4, 16, $AdresTxt, "_Garamond", 8, $PDF_ALIGN_RIGHT)  Use the _Paragraph function for multi-line text Link to comment Share on other sites More sharing options...
Vergil Posted June 2, 2017 Share Posted June 2, 2017 Hi, this UDF is a really good Job. awesome, how easy it is to create a pdf from your script, using this udf. But i have a Little Problem. I´d like to use a Font without serifs, so i decided to use Arial. But by using the TT, I get a space after each german umlaut (ä, Ă¼, ö). The Arial Standard works, when I open the created File, it always tells me, the /BBox value at Font Helvetica Bold is wrong.  Also there seem to be a bug at creating a Header like in the mixed Example. I can´t create a Header only for the first page. By using $PDF_OBJECT_FIRSTPAGE, it is created for all pages, exept of the first one. Same Problem with using $PDF_OBJECT_EVENPAGES and $PDF_OBJECT_ODDPAGES.  Example: expandcollapse popup#include <MPDF_UDF.au3> Const $iRand_links=20 Const $iRand_rechts=20 Const $iRand_oben=20 Const $iSeitenbreite=210-$iRand_rechts Const $iSeitenhohe=297-$iRand_oben _SetTitle("Test") _SetSubject("Test") _SetKeywords("Test") _OpenAfter(True) _SetUnit($PDF_UNIT_MM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_CUSTOM,90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) _InitPDF(@ScriptDir & "\Test.pdf") ;fonts: _LoadFontStandard("_Arial", $PDF_FONT_STD_ARIAL, $PDF_FONT_NORMAL) _LoadFontStandard("_ArialBold", $PDF_FONT_STD_ARIAL, $PDF_FONT_BOLD) _LoadFontStandard("_ArialIt", $PDF_FONT_STD_ARIAL, $PDF_FONT_ITALIC) ;=== create objects that are used in multiple pages === ;create a header on all pages, except the first: _StartObject("Header", $PDF_OBJECT_FIRSTPAGE) _DrawText($iRand_links, $iSeitenhohe, "This Header should only be at the 1st page!", "_Arial", 12, $PDF_ALIGN_LEFT) _EndObject() _BeginPage() _DrawText($iRand_links, $iSeitenhohe-50, "Arial standard", "_Arial", 12, $PDF_ALIGN_LEFT) _DrawText($iRand_links, $iSeitenhohe-55, "Arial standard Bold", "_ArialBold", 12, $PDF_ALIGN_LEFT) _DrawText($iRand_links, $iSeitenhohe-60, "Arial standard Italic", "_ArialIt", 12, $PDF_ALIGN_LEFT) _EndPage() _BeginPage() _EndPage() _BeginPage() _EndPage() _ClosePDFFile() Exit  Link to comment Share on other sites More sharing options...
DaLiMan Posted June 2, 2017 Share Posted June 2, 2017 On 2017-5-31 at 5:28 PM, dmob said: Use the _Paragraph function for multi-line text Hi dmob, Tried the paragraph function yesterday as you suggested, but unfortunately it is not helping me. It's probably me, but it seems to real problem is with $PDF_ALIGN_RIGHT. Somehow it does not align properly to the right. Closing the PDF with _ClosePDFFile() and then make it up again (in the same run) makes the text move to the left?! Although I decided to just have all text made up with $PDF_ALIGN_LEFT and have a lot of work aligning it at the right side    it would be helpfull for the future if $PDF_ALIGN_RIGHT would be working as expected.  Anyway, again, three thumbs up for this UDF!    Link to comment Share on other sites More sharing options...
dmob Posted June 3, 2017 Share Posted June 3, 2017 It's been a while since I used this UDF, and I have only used left and centre alignment with the paragraph function. I do remember though that the centre align initially challenged me, but I think I played around with the X position and offset, and got it right.... I suspect that may be your problem. The author has explained it in one the posts above...  Link to comment Share on other sites More sharing options...
Mannyfresh31 Posted February 22, 2018 Share Posted February 22, 2018 (edited) Hi there I tried to run one of your examples but I get an undefined function error ): Never mind the answer is on the replies above (:Â Edited February 22, 2018 by Mannyfresh31 Link to comment Share on other sites More sharing options...
Zedna Posted February 22, 2018 Share Posted February 22, 2018 (edited) Download previous AutoIt (ZIP) and exctract/copy this function _Iif() from Include/Misc.au3 to your script. Edited February 22, 2018 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mannyfresh31 Posted February 23, 2018 Share Posted February 23, 2018 (edited) This udf is great and thanks for bringing out but can somebody help me? I'm trying to center images with different sizes on top of the page I haven't been able to do it ):  Update: Never mind again I solved my own problem my self thanks anyway (: expandcollapse popup$ReceiptFileO = FileReadToArray(@ScriptDir & "\Recibos\" & $RecipeNum & ".log") $IMG = IniRead($Modefile, "IMG", "IMG", "") $IMGw = IniRead($Modefile, "IMG", "Width", "") $IMGw *= 0.26 $IMGh = IniRead($Modefile, "IMG", "Height", "") $IMGh *= 0.26 ;creating PDF ;set the properties for the pdf _SetTitle("Copia de Recibo No." & $RecipeNum) _SetSubject("Copia de Recibo No." & $RecipeNum) _SetKeywords("PDF, Copia, Loteia," & $RecipeNum) _OpenAfter(False) ;open after generation _SetUnit($PDF_UNIT_MM) _SetPaperSize("CUSTOM", _PrintGetPaperWidth($hp) /10, _PrintGetPaperHeight($hp) /10) _SetZoomMode($PDF_ZOOM_CUSTOM, 90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_DEFAULT) _SetPageWidth($pgwd / 10) _SetPageHeight($pght /10) ;initialize the pdf _InitPDF(@ScriptDir & "\Recibos\" & $RecipeNum & ".pdf") ;fonts: _LoadFontStandard("_Times", $PDF_FONT_STD_TIMES) ;stretch it a bit, down to 90% _SetTextHorizontalScaling(90) ;=== load resources used in pdf === If Not $IMG = "" Then MsgBox(0,"","Has image " & Int(_GetPageWidth() /_GetUnit() - $IMGw )) ;images: _LoadResImage("IMG", $IMG) _BeginPage() ;scale image to paper size! _InsertImage("IMG",Int( _GetPageWidth() /_GetUnit() - $IMGw ) ,Int( _GetPageHeight()/_GetUnit() - ($IMGh )) , $IMGw , $IMGh ) $Diezes = _GetPageHeight()/_GetUnit() - ($IMGh ) -10 For $aText In $ReceiptFileO _DrawText(10, $Diezes, $aText, "_Times", 12) $Diezes -= 2 Next _EndPage() Else $Diezes = (_GetPageHeight()/_GetUnit()) - 2 For $aText In $ReceiptFileO _DrawText(10, $Diezes, $aText, "_Times", 12) $Diezes -= 2 Next _EndPage() EndIf  Edited February 24, 2018 by Mannyfresh31 Problem solved 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