Jump to content



Photo

Create PDF from your application


211 replies to this topic

#1 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 24 August 2010 - 07:42 PM

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_Image2PDF
Thanks to xavierh for finding a missing space in the _LoadFontTT function (even it looks insignificant, that solved
an issue with text justification when using Adobe Reader, not Foxit Reader)

Total downloads old versions: 2044 + 21

Version 1.0.3: Attached File  MPDFv103.zip   176.07K   2595 downloads
Spoiler

Edited by taietel, 10 August 2011 - 09:38 PM.






#2 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 25 August 2010 - 11:57 AM

I've tried to edit my post and the code between autoit code tags was all scrambled!

I've attached the script in the first post and link to the fonts zip file.

#3 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 25 August 2010 - 05:02 PM

Hi taietel

I have tried it, it works well !

It seems there are lot of possibility of creation.

Thanks Posted Image

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#4 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 25 August 2010 - 05:45 PM

Hi wakillon! And thanks for the feedback.

I know there are a lot! You can write more functions based on what's on the script, make form-based apps and output to pdf, daily reports etc. Use your imagination!  ;) 

This is just a bare-bone I've decided to share.

#5 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 26 August 2010 - 12:01 PM

 For now I'm occupied with relocation, but hopefully this does not last forever.    ;)

M.I.

Edited by taietel, 30 August 2010 - 04:36 PM.


#6 kaotkbliss

kaotkbliss

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,106 posts

Posted 26 August 2010 - 08:24 PM

I'm definately interested because evidently I'm going to have to start creating a variable letter creation program...
I don't even know where to start but it almost looks like this will give me the answer. ;)
Posted Image010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My first project Allin1 Program launcherBill CalculatorGot <Insert problem here>?There's an AutoIt script for that!

#7 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 26 August 2010 - 08:33 PM

wakillon, since you're the only one interested in this, PM if you want to receive updates of this activex. For now I'm occupied with relocation, but hopefully this does not last forever. ;)

M.I.


I'm not the only interested, it's because there are a lot of timid people on this forum ! Posted Image



And Number of downloads: 73, it's cool right !

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#8 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 26 August 2010 - 08:47 PM

 Timid??? It's not the case! This can be solved!  ;)

I'm working in improving the dll and make the code more clean (I suck at that) and turn it into some kind of UDF.

Any suggestions are welcome! 

kaotkbliss, ask if anything is unclear!


M.I.

Edited by taietel, 26 August 2010 - 08:49 PM.


#9 kaotkbliss

kaotkbliss

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,106 posts

Posted 27 August 2010 - 03:50 PM

I'm sure I will have a ton of questions as I begin my project. I need to wrap your code into a gui that will allow a user to merge a database with completely customizable text, page size, number of pages, images, etc. that will be used in creating pdfs.

So, I guess my first question, I see you have some of the more common page sizes available (A4, Legal, Letter, etc.) Could this be set up for a custom size?
Posted Image010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My first project Allin1 Program launcherBill CalculatorGot <Insert problem here>?There's an AutoIt script for that!

#10 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 27 August 2010 - 06:03 PM

kaotkbliss, see the first post. Sorry for the late answer! It's my turn to cook!  ;)

I've deleted the old version and attached a new one. See the third page (it has custom dimensions) of the generated pdf.

#11 kaotkbliss

kaotkbliss

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,106 posts

Posted 27 August 2010 - 06:11 PM

Sweet. Now I need to start getting everything together. I'm sure I will have many many more as I attempt to tackle this project.
Posted Image010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My first project Allin1 Program launcherBill CalculatorGot <Insert problem here>?There's an AutoIt script for that!

#12 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 29 August 2010 - 09:43 AM

I've deleted the old version and attached a new one. See the third page (it has custom dimensions) of the generated pdf.


I wante to try your new version and i get an error...Posted Image



: ==> The requested action with this object has failed.: .FormatPage = $FORMAT_A4 .FormatPage = $FORMAT_A4^ ERROR ->11:42:10 AutoIT3.exe ended.rc:1 +>11:42:11 AutoIt3Wrapper Finished >Exit code: 1    Time: 1.528

Edited by wakillon, 29 August 2010 - 10:22 AM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#13 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 29 August 2010 - 10:17 AM

wakillon, that's because I've changed it to allow custom pages. 

Change

.FormatPage = $FORMAT_A4


with

.FormatPage ($FORMAT_A4)


Look in the example, at the third page (it has different dimensions; the first two are A4).




M.I.

#14 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 29 August 2010 - 10:26 AM

wakillon, that's because I've changed it to allow custom pages.

Change

.FormatPage = $FORMAT_A4


with

.FormatPage ($FORMAT_A4)


Look in the example, at the third page (it has different dimensions; the first two are A4).

Could you update archive, because with archive script i get only 2 pages
and with the script link I get another error ...Posted Image


\createpdf\pdfAutoit.au3 (166) : ==> The requested action with this object has failed.: .LoadAfm = @TempDir & "\Fonts" .LoadAfm = @TempDir & "\Fonts"^ ERROR ->12:24:13 AutoIT3.exe ended.rc:1 +>12:24:14 AutoIt3Wrapper Finished

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#15 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 29 August 2010 - 10:38 AM

wakillon, see the attachment in the first post (I've included all in the archive). 

M.I.

#16 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 29 August 2010 - 12:33 PM

wakillon, see the attachment in the first post (I've included all in the archive).

M.I.


Ah it's better, i see the 3 pages and the last with his big watermark , and no error ! Posted Image

How do you set the size of watermark ? i don't see parameters...

Thanks for all.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#17 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 29 August 2010 - 04:56 PM

Updated first post (see the screenshot of the first page). Now all the fonts are included in the script. 

wakillon, you can not change the watermark's parameters. Instead, you can replace it with a rotated, coloured etc text. 

M.I.

#18 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 29 August 2010 - 05:22 PM

Updated first post (see the screenshot of the first page). Now all the fonts are included in the script.

wakillon, you can not change the watermark's parameters. Instead, you can replace it with a rotated, coloured etc text.

M.I.


I'm unlucky, I download your last version ( with all embeded in the script ) and i get an error Posted Image

pdfAutoit.au3 (164) : ==> The requested action with this object has failed.: .LoadAfm = @TempDir & "\Fonts" .LoadAfm = @TempDir & "\Fonts"^ ERROR ->19:20:10 AutoIT3.exe ended.rc:1 +>19:20:11 AutoIt3Wrapper Finished

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#19 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 29 August 2010 - 05:50 PM

Solved! My mistake. See the first post!

[EDIT] The problem was that I've modified the dll, but I forgot to change the old one in the script... Now it works well.

I'm working to include form elements (basic ones - inputbox, checkbox) , but this might take a while...

Edited by taietel, 29 August 2010 - 06:01 PM.


#20 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,481 posts

Posted 29 August 2010 - 06:23 PM

Solved! My mistake. See the first post!

[EDIT] The problem was that I've modified the dll, but I forgot to change the old one in the script... Now it works well.

I'm working to include form elements (basic ones - inputbox, checkbox) , but this might take a while...



very unlucky...

pdfAutoit3\pdfAutoit.au3 (310) : ==> The requested action with this object has failed.: .Cell ($text4, $mLeft, $mTop+335, $AreaW-$mLeft, 12, "") .Cell ($text4, $mLeft, $mTop+335, $AreaW-$mLeft, 12, "")^ ERROR ->20:23:14 AutoIT3.exe ended.rc:1 +>20:23:15 AutoIt3Wrapper Finished

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users