Jump to content


Photo

Pdf Dll


  • This topic is locked This topic is locked
106 replies to this topic

#1 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 16 May 2006 - 03:24 AM

<span style='font-size:21pt;line-height:100%'>PDF DLL</span>

Last Update: 05/26/06
- Compression - optional compression of PDF file, for a smaller PDF file size.
- Decimal Bug Fix - fixed bug - decimal numbers can be used now.
- 2 new functions to set the title and author of the PDF at anytime.

Update: 05/20/06
- major image bug fixed

Update: 05/16/06
- major release
- new functions
- fixed a few bugs
- compressed DLL (very small DLL file size now :) )

This is my PDF DLL, it allows you to generate PDF files, duh...
I saw some one post GML a bit back to generate simple PDF files, so then I got an idea to make this DLL... :o

This DLL has many functions to create PDFs (more coming)
a few include:
- draw text
- add pages
- set title and author of PDF
- draw images (optional image link)
- add text links
- coloring options
- make bookmarks
- javascript functionality
- set font
- set subject and keywords
- set auto. zoom to 100%
- get page width and height and number functions
- and many more functions

I will continue to work on this to bring new functions :GM6:

Next Release Features:
These features have been completed and will be included with the next release:
- Draw circles
- Import Text/Create PDF's from text files
- Choose between portrait and landscape

This DLL is free. I do not require you to give me credit, since half of the people who would use this wouldn't anyway... :P but, I would love to be in any credits of a program or game you make.

You can download the ZIP file here. (right click-save as...)
This ZIP includes the pdfdll.dll and a GM6 file, which contains the required scripts and along with an example you can run. If you open the GM6 file and look at the scripts, there is a detailed description with each script, telling you what it does, what arguments to pass to the function, and what it returns.
Mirror: Mirror Download - pdfdll.zip (right click-save as...) (mirror added 05/19/06)

Thanks to:
SleeK GeeK - Reminding me about UPX
Thull - found bug with pdfdll_image (bug is now fixed)
Game Mage - first to make a program with the DLL. PDF-O-MATIC

Enjoy :GM6:

btw: I love replies ;) :)
and please report any bugs you find.
if you would like to see a new feature/function, tell me B)

Matt
  • 0

#2 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 16 May 2006 - 03:34 AM

:P.
Me likes.

Good job Matt!
-Steve
  • 0

#3 tsa05

tsa05

    GMC Member

  • GMC Member
  • 1063 posts
  • Version:GM:Studio

Posted 16 May 2006 - 03:49 AM

Holy smokes! That's incredible!
  • 0

#4 SleeK GeeK

SleeK GeeK

    The Biggest And The Best

  • New Member
  • 769 posts

Posted 16 May 2006 - 11:06 AM

Nice dll dude! One suggestion, your dll can be compressed to 19.5kb from 54kb using upx :P

Regards,
SleeK GeeK.
  • 0

#5 Porfirio

Porfirio

    GMC Member

  • GMC Member
  • 1209 posts

Posted 16 May 2006 - 11:32 AM

This is cool

May be very usefull!!
  • 0

#6 TGMG

TGMG

    G-java creator

  • New Member
  • 706 posts
  • Version:GM8

Posted 16 May 2006 - 01:07 PM

Very useful and if I use it for anything I will give you full credit :P
  • 0

#7 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 16 May 2006 - 06:14 PM

thanks guys for the good replies :o
I'll continue to improve it up and stuff, and I'll compress the next version with UPX... :P

Matt
  • 0

#8 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 17 May 2006 - 12:47 AM

Aparently you compressed it.

Even cooler!
Yep ill be using this dll in the near future (i think at least).
-Steve

Edited by Smarttart62, 17 May 2006 - 12:47 AM.

  • 0

#9 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 17 May 2006 - 11:31 PM

yeah I compressed it.

Ideas I have for the next release:
- Draw more different kinds of shapes
- Compressed PDF output
- Table/Cell drawing
- Auto. Page number text footer (ex: Page X)
- and some more stuff....

Matt
  • 0

#10 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 18 May 2006 - 09:02 PM

really cool!
keep going!!

this could be great for electronic game manuals!
  • 0
GM 8.1 / GM:HTML5 User

#11 Mentat

Mentat

    GMC Member

  • New Member
  • 42 posts

Posted 18 May 2006 - 10:48 PM

Great work!

If you add Table/Cell drawing this will be very very very useful.
  • 0

#12 Cloud Tower

Cloud Tower

    Transition Master!

  • New Member
  • 286 posts

Posted 19 May 2006 - 07:32 PM

Broken Link.
  • 0

#13 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 19 May 2006 - 08:38 PM

are you sure, link works for me
edit: I added a mirror to download PDFDLL, check the first post for the mirror download link; both download links, however, should work.

Edited by Matt13, 19 May 2006 - 09:30 PM.

  • 0

#14 Thull

Thull

    ACP Webdesigner

  • New Member
  • 340 posts

Posted 20 May 2006 - 02:23 AM

This dll is amazing! But I ran into one problem, whenever I put in a PNG image it says Error drawing image.(In PDF)

Any Ideas why?
  • 0

#15 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 20 May 2006 - 03:07 AM

Why isn't this a hot topic yet!?! This is wicked.
  • 0

#16 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 20 May 2006 - 02:36 PM

This dll is amazing! But I ran into one problem, whenever I put in a PNG image it says Error drawing image.(In PDF)

Any Ideas why?

<{POST_SNAPBACK}>

thanks, I don't know why your png file didn't work, I'll look into it. Make sure you had a valid PNG file, and did you try converting it to JPG to see if that worked?


Why isn't this a hot topic yet!?! This is wicked.

<{POST_SNAPBACK}>

hah thanks :)
  • 0

#17 Thull

Thull

    ACP Webdesigner

  • New Member
  • 340 posts

Posted 20 May 2006 - 02:42 PM

I have this code to create the image:

pdfdll_image(0,40,"gm_cd.jpg","");

The image is a jpg file called gm_cd, and it is in the same folder. it is a 200*200 image, and whenever I load the PDF file it says:


A drawing error occured.

and I click ok, and the image doesn't show...
  • 0

#18 Starkin Gamer

Starkin Gamer

    GMC Member

  • New Member
  • 16 posts

Posted 20 May 2006 - 02:46 PM

Great DLL dude!

And btw, I don't think the PDF file accepts png files. Normally, when a program creates a PDF it converts any oddball file formats to something more standard like GIF or JPG. Not 100% sure, but it makes sense.
  • 0

#19 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 20 May 2006 - 02:49 PM

hm very strange, I am getting the same errors, however it worked for me before?.... I'll see if I can find out what's going on and fix it.
  • 0

#20 Thull

Thull

    ACP Webdesigner

  • New Member
  • 340 posts

Posted 20 May 2006 - 02:50 PM

Alright. It's a very good DLL, I've tried using Pngs, JPGs, Gifs....everything.


Great job on the rest though! :)
  • 0

#21 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 20 May 2006 - 02:53 PM

alright, I've found the error, I will fix it, may take a bit of time though, and I shall re-upload when I fix it :]
  • 0

#22 Game Mage

Game Mage

    GMC Member

  • New Member
  • 128 posts

Posted 20 May 2006 - 03:02 PM

This is awesome, i honestly do not know why this isn't a hot topic yet, it is totally wicked!!! This is soooo awesome, it's just brilliant. How the hell did u do it?
  • 0

#23 SleeK GeeK

SleeK GeeK

    The Biggest And The Best

  • New Member
  • 769 posts

Posted 20 May 2006 - 03:38 PM

This is awesome, i honestly do not know why this isn't a hot topic yet, it is totally wicked!!! This is soooo awesome, it's just brilliant. How the hell did u do it?

<{POST_SNAPBACK}>

You could read the PDF file format if you really want to know how it works. Still curious?, open the generated PDF in notepad, everything becomes clear. :)

Regards,
SleeK GeeK.
  • 0

#24 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 20 May 2006 - 05:19 PM

Updated:
The bug with images has been fixed.
Please download the new version (2.01) for the fix.
Enjoy :)
Please tell me if this works for you now. :)
  • 0

#25 GamerNet

GamerNet

    ASCII Games designer

  • New Member
  • 26 posts

Posted 20 May 2006 - 07:18 PM

Woah!
Great dll. Very useful! 10/10!
:)
  • 0

#26 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 20 May 2006 - 09:57 PM

Woohoo. Matt = Rox.

I still havent a use for it yet, but when i do... Yeah... :)
-Steve
  • 0

#27 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 20 May 2006 - 11:21 PM

The new version is reeeally useful.
  • 0
GM 8.1 / GM:HTML5 User

#28 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 20 May 2006 - 11:24 PM

yay thanks everyone.
I'll continue adding more functions, you can check the first post in the topic to see what functions I already added to the version that will be released next.

Matt
  • 0

#29 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 20 May 2006 - 11:28 PM

will you add encryption?
  • 0
GM 8.1 / GM:HTML5 User

#30 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 21 May 2006 - 12:20 AM

It's pretty cool, but seeing as I've never really liked PDFs.... I really have no use for it. But it's a great DLL nonetheless.

-IMP ;) :angry:
  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny:


#31 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 21 May 2006 - 12:29 AM

I've never liked PDF's untill i realized the sense of professionality they bring.
-Steve
  • 0

#32 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 21 May 2006 - 01:10 AM

PDF's are really nice. I started to look into them more now.

will you add encryption?

I shall look into this, may not be in my next release however.
  • 0

#33 SleeK GeeK

SleeK GeeK

    The Biggest And The Best

  • New Member
  • 769 posts

Posted 21 May 2006 - 03:23 AM

PDFs provide more security than standard documents and have plently of features. The most important feature of it is that it can be viewed in any PC, MAC etc. which has adobe acrobat reader installed. Its provides portable features, as the name suggests.

Regards,
SleeK GeeK.
  • 0

#34 Mauros

Mauros

    GMC Member

  • New Member
  • 122 posts

Posted 21 May 2006 - 10:38 AM

not comment....

BUT 20/10
  • 0

#35 Fragment

Fragment

    GMC Member

  • GMC Member
  • 326 posts
  • Version:GM:Studio

Posted 21 May 2006 - 10:58 AM

Great job, it can give good results. I have managed to make a contents page for my upcomming game. Its really easy to make and it saves money on buying pdf creation slots from adobe :angry:, nice job. 10/10

ill show my place holder manual (the axe was just taken from google to test with)

http://img93.imagesh...stmanual2ng.png

Edited by Fragment, 21 May 2006 - 11:01 AM.

  • 0

bannergmmentors5.png


#36 Game Mage

Game Mage

    GMC Member

  • New Member
  • 128 posts

Posted 21 May 2006 - 05:33 PM

This is awesome, i honestly do not know why this isn't a hot topic yet, it is totally wicked!!! This is soooo awesome, it's just brilliant. How the hell did u do it?

<{POST_SNAPBACK}>

You could read the PDF file format if you really want to know how it works. Still curious?, open the generated PDF in notepad, everything becomes clear. :angry:

Regards,
SleeK GeeK.

<{POST_SNAPBACK}>


I did but it came up as lots of random letters and symbols.
  • 0

#37 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 21 May 2006 - 06:58 PM

Yeah that will most likely happen to all of the pictures... I think at least.
-Steve
  • 0

#38 teej

teej

    The PIXEL'er

  • GMC Member
  • 841 posts
  • Version:GM:Studio

Posted 22 May 2006 - 12:29 AM

great dll

i can possibly make
a professional program with it.

like say, a comic builder thing
since comics looks good on pdf

cool... now i will try to make one.

thanks for this wonderful dll
  • 0

#39 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 22 May 2006 - 12:48 AM

thanks everyone ;) and your welcome for the dll.
Yes, when you view the pdf document in like wordpad for example, you will be able to see everything. The optional compression option, available in the next release I have, compresses it and does make it a bit harder to read...
You can actually make a 'visual pdf maker' with this....

Matt
  • 0

#40 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 22 May 2006 - 01:45 AM

I was thinking about making a PDF builder with it... But then i decided against it because the two liter bottle of vault told me not to...
-Steve
  • 0

#41 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 22 May 2006 - 08:43 PM

*EDIT* Nevermind, I just saw where it only works with JPEG/PNGs. I was trying with GIFs... is there any way to change that?

-IMP ;) ;)

*EDIT* Also, without another DLL, is there a way to import PNGs into GameMaker? Because otherwise, we're limited to only allowing JPEGs as user-defined images in PDFs.

Edited by IceMetalPunk, 22 May 2006 - 08:49 PM.

  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny:


#42 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 22 May 2006 - 08:47 PM

EDIT: no, not at the moment, JPG/JPEG and PNG only right now. sorry. ;) Most likely in a future release ;)

EDIT:

*EDIT* Also, without another DLL, is there a way to import PNGs into GameMaker? Because otherwise, we're limited to only allowing JPEGs as user-defined images in PDFs.

why would you only be limited to using JPEGs and not PNGs? I don't think I understand the question fully.

Edited by Matt13, 22 May 2006 - 08:59 PM.

  • 0

#43 Game Mage

Game Mage

    GMC Member

  • New Member
  • 128 posts

Posted 22 May 2006 - 09:01 PM

I have just created a program called PDF-O-MATIC that allows you to create your own PDFs using this awesome dll. Please check it out using the link below.

PDF-O-MATIC


---Game Mage---
  • 0

#44 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 22 May 2006 - 09:04 PM

Awesome!! ;) ;)
  • 0

#45 Game Mage

Game Mage

    GMC Member

  • New Member
  • 128 posts

Posted 22 May 2006 - 09:34 PM

Thanks.

A few suggestions for your next update.

*Tables
*Make it so the text wraps when it reaches the end of the screen
  • 0

#46 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 22 May 2006 - 10:14 PM

EDIT: no, not at the moment, JPG/JPEG and PNG only right now. sorry.  :P  Most likely in a future release  ;)

EDIT:

*EDIT* Also, without another DLL, is there a way to import PNGs into GameMaker? Because otherwise, we're limited to only allowing JPEGs as user-defined images in PDFs.

why would you only be limited to using JPEGs and not PNGs? I don't think I understand the question fully.

<{POST_SNAPBACK}>


Because, user-defined images (meaning the user picks them off his/her computer) can only be loaded into GameMaker as JPEGs, GIFs, and BMPs. Since this DLL can't use BMPs or GIFs, only JPEGs can be used.

But I just found another issue. I'm designing a drag-and-drop, Object-Oriented GUI for a PDF-maker. I used pdfdll_getpagewidth and pdfdll_getpageheight to get the size of the page and define an area. I then placed images/text where they looked good in a layout. When I created the PDF file, however, they are all spread out. I tried using the pdfdll_zoom100, and it did the same thing (the width and height remain the same size). What's going on here, and how do I fix it?

-IMP :D ;)

*EDIT* I just made a text size 50 pt with my program. It looks as though it takes up the entire width of the page in GM (which the page is defined with pdfdll_getpagewidth/height), but in the PDF, it's not even close to the entire width (but it IS going to 50pt, I know that much). This is part of the layout issues, I'm guessing?

*EDIT2* I found out that text is aligned at the bottom-left, and images are from the top-left,. However, the spaces between all the images/text are so much larger than they are in my program. Are the PDF page width/height functions scaled or something? If so, by how much?

Edited by IceMetalPunk, 23 May 2006 - 12:28 AM.

  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny:


#47 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 23 May 2006 - 02:02 AM

*EDIT2* I found out that text is aligned at the bottom-left, and images are from the top-left,. However, the spaces between all the images/text are so much larger than they are in my program. Are the PDF page width/height functions scaled or something? If so, by how much?

I don't think they should be scaled....

*EDIT* I just made a text size 50 pt with my program. It looks as though it takes up the entire width of the page in GM (which the page is defined with pdfdll_getpagewidth/height), but in the PDF, it's not even close to the entire width (but it IS going to 50pt, I know that much). This is part of the layout issues, I'm guessing?

I have no clue, but it is what adobe reads it as, the pdf code is correct, I am like 99.9% sure....

Because, user-defined images (meaning the user picks them off his/her computer) can only be loaded into GameMaker as JPEGs, GIFs, and BMPs. Since this DLL can't use BMPs or GIFs, only JPEGs can be used.

why are you loading them into Game Maker? Just add them as the file name, so you can have both JPEGs/JPGs and PNGs? (unless I still don't understand)

-------------------------------------------------------------------------------

Thanks.

A few suggestions for your next update.

*Tables
*Make it so the text wraps when it reaches the end of the screen

Thanks, and I'll take these in to consideration. :blink:

Matt

Edited by Matt13, 23 May 2006 - 02:04 AM.

  • 0

#48 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 23 May 2006 - 07:12 PM

*EDIT2* I found out that text is aligned at the bottom-left, and images are from the top-left,. However, the spaces between all the images/text are so much larger than they are in my program. Are the PDF page width/height functions scaled or something? If so, by how much?

I don't think they should be scaled....

...

Because, user-defined images (meaning the user picks them off his/her computer) can only be loaded into GameMaker as JPEGs, GIFs, and BMPs. Since this DLL can't use BMPs or GIFs, only JPEGs can be used.

why are you loading them into Game Maker? Just add them as the file name, so you can have both JPEGs/JPGs and PNGs? (unless I still don't understand)

<{POST_SNAPBACK}>


If they're not scaled, then I don't know why the width/height functions are returning such a small area when the actual PDF is so much bigger (and since the distance between images/text are larger as well, I really think they must be scaled).

As for the images, what I mean is this: If I were to make a program that uses this DLL to allow the user of the program to create PDFs, I'd want them to be able to use their own images. To do that, they'd need to load those images into GameMaker with the sprite_add functions. And those functions only allow BMP, GIF, and JPEG images. Your DLL can only use JPEG and PNG, so the only type of images that people can use of their own images are JPEGs.

-IMP :blink: :blink:
  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny:


#49 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 23 May 2006 - 07:33 PM

oh, I see what you mean.... I'll get to work as soon as I can with updating the DLL. Right now I gotta do homework... like fun physics... then in a few hours I am heading to a meeting I must attend. I will, however, add functionality for BMPs next most likely.

Matt
  • 0

#50 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 23 May 2006 - 07:47 PM

Thanks, no rush :blink:

Also, I think I'm getting closer to the cause of the "layout issues" that I mentioned before. It's actually an issue with the positioning.

I created a PDF that auto-zooms to 100%. I set the text "KKKKKKK" in size 12pt (so it should be about 12px high) at position (0,2). It cut off the K's right above the crooks (the intersections of the three lines), about 1 or 2 pixels above it. Then, I set the SAME text at (0,1). 1 pixel higher should have cut off the K's at or above the crooks, but it cut them off almost at the bottom.

So the (X,Y) coordinates aren't correct, if 1 pixel difference in the (X,Y) coordinate is equal to 2 or 3 pixels in the actual PDF. It seems like it is scaled.... or something else?

-IMP :blink: :blink:
  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: