FromImage2PDF.dll ================= You can use it with all well known ides (.NET-IDEs, too!) Try it with Visual Basic, VBA, VB2005/VB2008 Express, Delphi, C, C++, C# ... >>> This is the shareware version... >>> Try before you buy... >>> And if there're any questions - ask me. >>> Thanks for trying! About installation and working with the dll... ---------------------------------------------- This dll doesn't have an entry point so it's not necessary to register it. Only copying into the system32-directory or in the directory where your application is installed. If you're using vba (from ms access or excel for example) you should declare the functions as private and not public. Using .NET-environments (like MS Visual Studio) it's often better (to avoid stack errors) to change the parameter-types from longinteger to integer or int32 /vb2005/vb2008 or UInt32 for C#). If you don't need an integer-parameter you should insert the value 0. If you're working with a special "format" then other parameters having to do with width and height will be ignored. Hints/advices for you... ------------------------ If you want to convert the single pages of a tiff-file to pdf: 1. Use GetTIFFcount to get the number of tiff-pages. 2. Creating a for-loop in your code. 3. Working with the tiff-file while adding one to the parameter "tiffpage" until the max. pagenumber. 4. Now you've got a pdf from each tiff-page. For the library there is a help-program to test the function immediately: ------------------------------------------------------------------------- H_FromImage2PDF.exe As source example there is a delphi-, vb- and vb2005express-project included: ----------------------------------------------------------------------------- FromImage2PDF_delphi5.zip (the sample as Delphi 5 source) FromImage2PDF_vb60.zip (the sample as VB 6.0 source) FromImage2PDF_vb2008express.zip (the sample as vb2008 express source) contact: webmaster@pdf-analyzer.com info/help: http://www.pdf-analyzer.com http://www.is-soft.de Ingo Schmoekel - Software-Dev.& Distribution - Zedernstr.30a D-28832 Achim - Uesen GERMANY Kinds of returned (error) codes: -------------------------------- Image2PDF: ---------- 9001 = Imagefile not found 9003 = New targetfile must be a pdf-file 9004 = Imagefiletype isn't allowed (for GetTIFFcount) 9005 = The selected tiffpagenumber is higher than the max tiffpage 9006 = Error while examine a tiff-file 1 = As returning value means okay GetTIFFcount: ------------- 9001 = Imagefile not found 9004 = Imagefiletype isn't allowed ... = All other returning value is the tiffpagecount functions with the type of values and the meaning: -------------------------------------------------- Image2PDF ========= function Image2PDF(const ImageName: PChar; PDFName: PChar; tiffpage: LongInt; title: PChar; author: PChar; subject: PChar; keywords: PChar; border: LongInt; format: PChar; mmwidth: LongInt; mmheight: LongInt; rgb1: PChar; rgb2: PChar; rgb3: PChar; ctm: LongInt; transp: LongInt; comp: LongInt; print: LongInt; copy: LongInt; change: LongInt; comment: LongInt; enc: LongInt; mp: PChar; up: PChar): LongInt; stdcall; Numeric parameters needs always content. If you don't need them put in a zero! * ImageName Filename and -path of the imagefile * PDFName Name and -path of the PDF-file generated from the image. If this parameter is empty. The generated pdf-file is in the same directory where the image is. The pdf-file is named like the image file with a ".pdf" added. * tiffpage A TIFF-File can contain many images - tiffpage can contain the special image-number you want to convert. If you insert here 99999 then all pages of a tif-file will be converted in one pdf-document. * title Title you can set for the PDF-metadata. * author Author you can set for the PDF-metadata. * subject Subject you can set for the PDF-metadata. * keywords Keywords you can set for the PDF-metadata. * border No border (=0) or the value in pixel (max value is a quarter from the selected PageSize. When landscape you should compare with PageHeight - When portrait you should compare with PageWidth. * format Ready made formats like A0 to A10, B0 to B10, ISOB0 to ISOB10, C0 to C7, DL, Letter, Legal, Statement, Tabloid, Ledger, Executive, Folio... Portrait is normal. If you want landscape you can add the word Landscape behind the format (for example "A4 Landscape"). If you have selected a border, the border strength will be substracted from the selected format. So A4 is A4 - with and without border. If there's a selected format the parameters mmwidth and mmheight will be unconsidered. Without format, mmwidth and mmheight the original image-size will be used. If there's a border it will be added. * mmwidth Image-width on the pdf-page in pixels (automatically centered). Borders will be added. So an image with 200 x 150 and a border 25 will have the dimensions 250 x 200. Without format, mmwidth and mmheight the original image-size will be used. If there's a border it will be added. * mmheight Image-height on the pdf-page in pixels (automatically centered). Borders will be added. So an image with 200 x 150 and a border 25 will have the dimensions 250 x 200. Without format, mmwidth and mmheight the original image-size will be used. If there's a border it will be added. * rgb1-3 The values for Red/Green/Blue. You can use this colours on the border of a generated pdf-file (if you set a border value). Examples for colours are: White : 1,0 / 1,0 / 1,0 Black : 0,0 / 0,0 / 0,0 Dark grey : 0,1 / 0,1 / 0,1 Grey : 0,3 / 0,3 / 0,3 Light grey : 0,7 / 0,7 / 0,7 Red : 1,0 / 0,0 / 0,0 Green : 0,0 / 1,0 / 0,0 Blue : 0,0 / 0,0 / 1,0 Dark blue : 0,0 / 0,0 / 0,2 Smooth yellow : 1,0 / 1,0 / 0,5 [Attention: Use comma - not point!] ...the number of colours is endless! * ctm The position is centered - you can determine really top (=0), centered (=1) or a bit top (=2). * transp If you want you can set here a transparency value from 0 (= no/solid) till 100 (= invisible). * comp Compress... 0=No 1=Yes. All contents of a pdf-file (page, image, font) will be compressed. Mostly the success is little 'cause only images can be mentionable shrinked and often jpegs are used (jpg is already shrinked). * print Allow to print 1=No 0=Yes * copy Allow to copy 1=No 0=Yes * change Allow changes 1=No 0=Yes * comment Allow comments 1=No 0=Yes * enc Encryption strength 0=No 1=40bit 2=128bit 3=128bit aes * mp Masterpassword (to protect your settings) * up Userpassword (to be entered before/while opening the pdf GetTIFFcount ============ function GetTIFFcount(const ImageName: PChar): LongInt; stdcall; * ImageName Filename and -path of the tiff-image. Returning value --------------- The returning value will be the number of the tiffpages. Delphi-source as an example =========================== unit H_FromImage2PDF; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; // . . . var Form1: TForm1; function Image2PDF(const ImageName: PChar; PDFName: PChar; tiffpage: LongInt; title: PChar; author: PChar; subject: PChar; keywords: PChar; border: LongInt; format: PChar; mmwidth: LongInt; mmheight: LongInt; rgb1: PChar; rgb2: PChar; rgb3: PChar; ctm: LongInt; transp: LongInt; comp: LongInt; print: LongInt; copy: LongInt; change: LongInt; comment: LongInt; enc: LongInt; mp: PChar; up: PChar): LongInt; stdcall; function GetTIFFcount(const ImageName: PChar): LongInt; stdcall; implementation {$R *.DFM} function Image2PDF(const ImageName: PChar; PDFName: PChar; tiffpage: LongInt; title: PChar; author: PChar; subject: PChar; keywords: PChar; border: LongInt; format: PChar; mmwidth: LongInt; mmheight: LongInt; rgb1: PChar; rgb2: PChar; rgb3: PChar; ctm: LongInt; transp: LongInt; comp: LongInt; print: LongInt; copy: LongInt; change: LongInt; comment: LongInt; enc: LongInt; mp: PChar; up: PChar): LongInt; stdcall; external 'FromImage2PDF.dll'; function GetTIFFcount(const ImageName: PChar): LongInt; stdcall; external 'FromImage2PDF.dll'; // . . . procedure TForm1.Button2Click(Sender: TObject); var Save_Cursor : TCursor; begin Edit2.Text := ''; Edit2.Refresh; Edit2.Repaint; Save_Cursor := Screen.Cursor; Screen.Cursor := crHourglass; { Show hourglass cursor } Form1.Repaint; Edit2.Text := IntToStr(Image2PDF(PChar(Edit1.Text), PChar(Edit3.Text), StrToInt(Trim(Edit8.Text)), PChar(Edit4.Text), PChar(Edit5.Text), PChar(Edit21.Text), PChar(Edit6.Text), StrToInt(Trim(Edit11.Text)), PChar(Trim(Edit7.Text)), StrToInt(Trim(Edit13.Text)), StrToInt(Trim(Edit14.Text)), PChar(Trim(Edit22.Text)), PChar(Trim(Edit23.Text)), PChar(Trim(Edit24.Text)), StrToInt(Trim(Edit10.Text)), StrToInt(Trim(Edit12.Text)), StrToInt(Trim(Edit9.Text)), StrToInt(Trim(Edit15.Text)), StrToInt(Trim(Edit16.Text)), StrToInt(Trim(Edit17.Text)), StrToInt(Trim (Edit26.Text)), StrToInt(Trim(Edit18.Text)), PChar(Trim(Edit19.Text)), PChar(Trim(Edit20.Text)))); Screen.Cursor := Save_Cursor; { Always restore to normal } end; procedure TForm1.Button3Click(Sender: TObject); begin Edit25.Text := ''; Edit25.Text := IntToStr(GetTIFFcount(PChar(Edit1.Text))); end; // . . . VisualBasic-source as an example ================================ Module1: -------- Public Declare Function Image2PDF Lib "FromImage2PDF.dll" (ByVal ImageName As String, ByVal PDFName As String, ByVal tiffpage As Long, ByVal title As String, ByVal author As String, ByVal subject As String, ByVal keywords As String, ByVal border As Long, ByVal format As String, ByVal mmwidth As Long, ByVal mmheight As Long, ByVal rgb1 As String, ByVal rgb2 As String, ByVal rgb3 As String, ByVal ctm As Long, ByVal transp As Long, ByVal comp As Long, ByVal pri As Long, ByVal copy As Long, ByVal change As Long, ByVal comment As Long, ByVal enc As Long, ByVal mp As String, ByVal up As String) As Long Public Declare Function GetTIFFcount Lib "FromImage2PDF.dll" (ByVal ImageName As String) As Long Form1: ------ 'if you want to know the number of pages in a tiff-file... Private Sub Command1_Click() Text16.Text = GetTIFFcount(Text1.Text) End Sub Private Sub Form_Load() Text3.Text = "" End Sub Private Sub option3_Click() Dim res, pri, copy, change, ctm, enc As Long Text3.Text = "" If Check1.Value = True Then pri = 1 Else pri = 0 End If If Check2.Value = True Then copy = 1 Else copy = 0 End If If Check3.Value = True Then change = 1 Else change = 0 End If If Check4.Value = True Then comment = 1 Else comment = 0 End If If Option5.Value = True Then ctm = 1 End If If Option6.Value = True Then ctm = 2 End If If Option7.Value = True Then ctm = 0 End If If Option1.Value = True Then enc = 0 End If If Option2.Value = True Then enc = 1 End If If Option4.Value = True Then enc = 2 End If If Option8.Value = True Then enc = 3 End If ' here is a line for your information with the name of all parameters ... ' the real call follows in the next line ... ' Result ImageName PDFName tiffpage title author subject keywords border format mmwidth mmheight rgb1 rgb2 rgb3 ctm transp comp pri copy change enc mp up Text3.Text = Image2PDF(Text1.Text, Text2.Text, Val(Text17.Text), Text6.Text, Text7.Text, Text9.Text, Text8.Text, Val(Text10.Text), Text15.Text, Val(Text11.Text), Val(Text12.Text), Text18.Text, Text19.Text, Text20.Text, ctm, Val(Text13.Text), Val(Text14.Text), pri, copy, change, comment, enc, Trim(Text4.Text), Trim(Text5.Text)) End Sub