Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Conf: (P-PDF) Developers, Msg: 59339
From: Andrew Kerr
Date: 5/29/2002 05:38 PM

Well, slap me silly and call me 'Marion' the solution was in front of me the whole time (well, since I downloaded the PDFlib eval library!).

An example is included in the download which demonstrates loading a jpg and converting to pdf. After a couple of runs I still didn't think it worked but after opening my eyes and 5 mins of debugging analysis I discovered that what looked to be a 'doing nothing' routine was actually doing the business better than expected so situation over and thanks to Aandi and Leonard for helping me out.

Below is the code required to load an image and save the PDF with information.


'Ensure the PDFlib_com.dll is referenced via

Option Explicit

Sub main()
Dim ret As Long, font As Long
Dim oPDF As PDFlib_com.PDF
Dim imageFile As String
Dim lWidth, lHeight As Long
Dim lImage As Long

Set oPDF = New PDFlib_com.PDF

ret = oPDF.open_file("c:\dev\ak_test.pdf")
If (ret = -1) Then
MsgBox "Couldn't open PDF file!"
End If

oPDF.set_info "Creator", "VisBasic 6.0"
oPDF.set_info "Author", "Andrew Kerr"
oPDF.set_info "Title", "Test Output via PDFlib"

imageFile = "C:\dev\test1.tif"

lImage = oPDF.open_image_file("tiff", imageFile, "", 0)
If (lImage = -1) Then
MsgBox "Couldn't open image file!"
End If

' We generate a page with the image's dimensions
lWidth = oPDF.get_value("imagewidth", lImage)
lHeight = oPDF.get_value("imageheight", lImage)

' start a new page
oPDF.begin_page lWidth, lHeight

' Place the image in the lower left corner
oPDF.place_image lImage, 0, 0, 1

oPDF.end_page ' finish page
oPDF.Close ' close PDF document

Set oPDF = Nothing

End Sub


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.