pintas Posted June 30, 2011 Share Posted June 30, 2011 To get the image the same size i had to change this: $iW = $_iImageW/_GetUnit() $iH = $_iImageH/_GetUnit() To: $iW = $_iImageW/_GetUnit()/1.6 $iH = $_iImageH/_GetUnit()/1.6 It's working for me now Link to comment Share on other sites More sharing options...
taietel Posted June 30, 2011 Author Share Posted June 30, 2011 (edited) What unit are you using? [edit] Doesn't matter. The difference maybe lies in the fact that when printing, the pdf reader tends to shrink the page to less than 100%. Edited June 30, 2011 by taietel 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...
pintas Posted June 30, 2011 Share Posted June 30, 2011 Oh, i see. Well... if it's working, it's perfect Link to comment Share on other sites More sharing options...
rosmild Posted June 30, 2011 Share Posted June 30, 2011 Hi Taietel, many thanks, you've done a really good job!! I've just a little problem, if I try to launch pdf creation by a button in a GUI, pdf was created but GUI closed. rosmild Link to comment Share on other sites More sharing options...
taietel Posted June 30, 2011 Author Share Posted June 30, 2011 (edited) rosmild, the problem lies within the GUI portion of your script. Can you post a simplified example? [EDIT] Nope, in _ClosePDF(), at the end: just delete the word Exit just before EndFunc. I forgot to delete it (a sign of getting old? yep!). Edited June 30, 2011 by taietel 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...
rosmild Posted June 30, 2011 Share Posted June 30, 2011 [EDIT] Nope, in _ClosePDF(), at the end: just delete the word Exit just before EndFunc. I forgot to delete it (a sign of getting old? yep!). Yes, now it works fine!!! Many thanks rosmild Link to comment Share on other sites More sharing options...
pintas Posted July 1, 2011 Share Posted July 1, 2011 Hey taiatel, can you post an example how to use _GetTextLength? I'm trying to center some text (with variable size) between two vertical lines, like this: | text | But when i do the following i get a value zero: _DrawLine(13, 10, 13, 22, $PDF_STYLE_STROKED, 1, 0.01, 0x16007B) _DrawLine(4, 10, 4, 22, $PDF_STYLE_STROKED, 1, 0.01, 0x16007B) $sText="text string" $size=_GetTextLength($sText, "_Arial_Bold", 14) ;~ msgbox("",$size,"") _DrawText(9-$size/2, 15, StringUpper($sText), "_Arial_Bold", 14,$PDF_ALIGN_CENTER); pretending the space from line 1 to line 2 is size 9 I'm pretty sure i'm doing something wrong.... but what? Link to comment Share on other sites More sharing options...
taietel Posted July 1, 2011 Author Share Posted July 1, 2011 Something like this (again, don't use Adobe Reader, use Foxit Reader): expandcollapse popup#include "MPDF_UDF.au3" ;set the properties for the pdf _SetTitle("Demo PDF in AutoIt") _SetSubject("Demo PDF in AutoIt, without any ActiveX or DLL...") _SetKeywords("pdf, demo, 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 & "\example.pdf") ;fonts: _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;start a page _BeginPage() $sText = "Anna Montes ridiculus, in penatibus, in aliquam enim sagittis pellentesque? Mattis duis et ut nunc sagittis enim " $sText &= "tortor urna, eros? Scelerisque? Dapibus scelerisque vel rhoncus porttitor! Porttitor ridiculus. In adipiscing augue " $sText &= "vel pellentesque tortor porta hac tristique turpis placerat scelerisque elementum hac pulvinar mid dolor pellentesque " $sText &= "lundium mattis nec. Nec sed. Et adipiscing nec nisi elementum natoque! Turpis penatibus est dictumst magnis integer " $sText &= "scelerisque, sociis, risus scelerisque ultrices auctor porta, enim? Ac montes pellentesque cum enim augue penatibus " $sText &= "pulvinar? Vel mid, cum habitasse etiam urna? In? Et, natoque! Integer odio egestas! Rhoncus a vut natoque pellentesque " $sText &= "diam lundium augue in mus. Auctor, dictumst lacus turpis phasellus etiam, proin mauris. Natoque ultricies turpis nisi " $sText &= "platea parturient? Nunc nascetur est, adipiscing enim turpis Mihai." _DrawLine(2, 22.5, 2, 17, $PDF_STYLE_STROKED, 10, 0.1, 0xff0000, 0, 0) _Paragraph($sText, 2.5, 22, 10, "_Calibri", 10, 0) _DrawLine(13, 22.5, 13, 17, $PDF_STYLE_STROKED, 10, 0.1, 0xff0000, 0, 0) _EndPage() ;write the buffer to disk _ClosePDFFile() 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...
pintas Posted July 1, 2011 Share Posted July 1, 2011 (edited) Yeah, there's a difference with acrobat reader. But i just want to center the text between the two lines. That way i can only align it. I'm looking for something like this: | text | | sdflkjgs | | asdfasdfasdfasdf | | asdfasdfasdf | Edited July 1, 2011 by pintas Link to comment Share on other sites More sharing options...
taietel Posted July 1, 2011 Author Share Posted July 1, 2011 (edited) There are many differences between Acrobat and Foxit. I'll try to make the resulted pdf's to look the same in both, but in time. Regards, taietel [EDIT] I just saw you've edited your post. To do that, 1. draw the lines 2. at half the distance between lines insert the text as usual, not paragraph, but aligned to center expandcollapse popup#include "MPDF_UDF.au3" ;set the properties for the pdf _SetTitle("Demo PDF in AutoIt") _SetSubject("Demo PDF in AutoIt, without any ActiveX or DLL...") _SetKeywords("pdf, demo, 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 & "\example.pdf") ;fonts: _LoadFontTT("_TimesT", $PDF_FONT_TIMES) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;start a page _BeginPage() $sText1 = "ridiculus" $sText2 = "tortor urna" $sText3 = "vel pellentesque" $sText4 = "lundium mattis" _DrawLine(2, 22.5, 2, 20, $PDF_STYLE_STROKED, 10, 0.1, 0xff0000, 0, 0) _DrawText(7.5, 22, $sText1, "_Calibri", 10, $PDF_ALIGN_CENTER) _DrawText(7.5, 21.5, $sText2, "_Calibri", 10, $PDF_ALIGN_CENTER) _DrawText(7.5, 21, $sText3, "_Calibri", 10, $PDF_ALIGN_CENTER) _DrawText(7.5, 20.5, $sText4, "_Calibri", 10, $PDF_ALIGN_CENTER) _DrawLine(13, 22.5, 13, 20, $PDF_STYLE_STROKED, 10, 0.1, 0xff0000, 0, 0) _EndPage() ;write the buffer to disk _ClosePDFFile() Edited July 1, 2011 by taietel 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...
pintas Posted July 1, 2011 Share Posted July 1, 2011 That simple? Perfect. Link to comment Share on other sites More sharing options...
LOULOU Posted July 21, 2011 Share Posted July 21, 2011 (edited) With VISTA Professional French version Autoit 3.6.1 and Acrobat 9.4 i have trouble when the file was printing in Acrobat , i have the following message "This page have an error. Acrobat may have a problem to display this page" Have you the same problem ? Edited July 21, 2011 by LOULOU Link to comment Share on other sites More sharing options...
powerofos Posted July 28, 2011 Share Posted July 28, 2011 Thank you Kim.Y Link to comment Share on other sites More sharing options...
UEZ Posted July 28, 2011 Share Posted July 28, 2011 Well done taietel Can be very useful when saving to pdf files!5* from me!Example_Image2PDF.au3 is causing an error for me when AR opens the created pdf: "There was an error opening this document. This file cannot be opened because it has no pages."Example_Txt2PDF.au3 is also causing an error after selecting MPDF_UDF.au3: "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem."Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
taietel Posted July 30, 2011 Author Share Posted July 30, 2011 (edited) Sorry for the delay (went on short(est) vacation). Thanks you all for the feedback. I found the bug ( ) responsible for Adobe Reader errors. Dennis Sandstrom (aka StuffByDennis) added two more functions: _Draw_Path and _Draw_Polygon (thanks for those, Dennis!) I have attached the updated version, without images. UEZ, welcome back! Regards, taietel [EDIT] Attachment moved to first post (lack of space) Edited August 10, 2011 by taietel 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...
LOULOU Posted July 30, 2011 Share Posted July 30, 2011 Thanks for your great application. Any chance that you implement Forms ? Link to comment Share on other sites More sharing options...
taietel Posted July 30, 2011 Author Share Posted July 30, 2011 LOULOU, there is always a chance, but time is a bug that can not be solved easily. 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...
happytc Posted August 9, 2011 Share Posted August 9, 2011 which filter does be applied? FlateDecode? Link to comment Share on other sites More sharing options...
happytc Posted August 9, 2011 Share Posted August 9, 2011 Well done taietel Can be very useful when saving to pdf files!5* from me!Example_Image2PDF.au3 is causing an error for me when AR opens the created pdf: "There was an error opening this document. This file cannot be opened because it has no pages."Example_Txt2PDF.au3 is also causing an error after selecting MPDF_UDF.au3: "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem."Br,UEZThe same Errors occured when run the two examples Link to comment Share on other sites More sharing options...
taietel Posted August 9, 2011 Author Share Posted August 9, 2011 happytc, have you tried the version from the post #95?No, I'm not using FlatDecode in the UDF. 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...
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