Image 2 PDF
The Aloaha Image2PDF API allows the user to convert any standard image such as BMP, GIF, TIF, JPG, PNG to PDF. Multipage TIF documents are supported as well.
You need to make sure that Aloaha is properly licensed. Otherwise the code samples will not work. To get an evaluation key please contact
aloaha@wrocklage.de
Please find the sample below:
dim pdf
dim imagepath
dim pdfpath
dim compression
dim sh
set pdf = createobject("aloahapdf.edit")
compression = 100 'no compression
imagepath = "c:\aloaha.bmp"
pdfpath = cstr(pdf.img2pdf(cstr(imagepath), clng(compression)))
if len(pdfpath)>0 then
Set sh = CreateObject("WScript.Shell")
sh.run cstr(pdfpath)
set sh = nothing
else
msgbox "Image could not be converted to PDF"
end if
set pdf = nothing
Advanced Function
advanced_im2pdf(imgpath, pdfpath, overwrite, imgcompression) As String
Private Sub Command3_Click()
Dim aloahapdf As Object
Dim dummy As String
Set aloahapdf = CreateObject("aloahapdf.edit")
dummy = aloahapdf.advanced_im2pdf("d:\DSCF0821.JPG", "d:\niels.pdf", True, 25)
Set aloahapdf = Nothing
End Sub
PDF 2 Image
With Aloaha it is also possible to convert a PDF back to Image files.
Please see the sample below:
dim inputfile
dim outputfile
dim i
inputfile ="\\linkstation\share\GV-cards01.pdf"
outputfile ="\\linkstation\share\GV-cards01-"
set pdf = createobject("aloahapdf.edit")
if pdf.load_pdf_to_mem(cstr(inputfile)) = true then
for i = 1 to pdf.TotalPages
CALL pdf.export_page(cstr(outputfile+cstr(i)+".bmp"), clng(i), clng(300))
next
end if
call pdf.unload_pdf_from_mem
set pdf = nothing
With Aloaha it is also possible to convert a PDF back to Image files.
Please see the sample below:
dim inputfile
dim outputfile
dim i
inputfile ="\\linkstation\share\GV-cards01.pdf"
outputfile ="\\linkstation\share\GV-cards01-"
set pdf = createobject("aloahapdf.edit")
if pdf.load_pdf_to_mem(cstr(inputfile)) = true then
for i = 1 to pdf.TotalPages
CALL pdf.export_page(cstr(outputfile+cstr(i)+".bmp"), clng(i), clng(300))
next
end if
call pdf.unload_pdf_from_mem
set pdf = nothing
Aloaha Software / Knowledge Base / PDF SDK / Image 2 PDF