Solved

How to merge multi pdf file into one pdf using access 2002 code

Posted on 2006-07-11
200
4,599 Views
Last Modified: 2013-12-02
How to merge multi pdf file into one pdf using access 2002 code without the user ok for each file created
0
Comment
Question by:dmpuser
  • 106
  • 65
  • 19
  • +2
200 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17081948
Hi dmpuser,

Access by itself cannot concatenate PDF files.

Regards,

Patrick
0
 

Author Comment

by:dmpuser
ID: 17081964
there is no solutions using access code?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17082016
have a look here
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=37121&lngWId=1&txtForceRefresh=122820042172096743

or pay for a program, one that can run from command line so u can code this in vba easily - here is one, not sure if it can do what u want though http://www.verypdf.com/pdfpg/index.html
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:dmpuser
ID: 17082135
I can do it using adobe professional writer (I define default printer of my access report the ADOBE PDF printer) but I must click the filename for each file pdf created so I lost the security of my application because the file generated must be a file protected ! do you hundstand?
0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 168 total points
ID: 17082480
I'm not sure how available the components are - but I remember a question by Jim a while back that was merging pdf files.
http://www.experts-exchange.com/Databases/MS_Access/Q_21836830.html
(Ain't Adobe though).
0
 

Author Comment

by:dmpuser
ID: 17082729
ok I have tried to adapt the code in my access project but I recived error in

 AddFilterItem and

CommonFileOpenSave

Can u help me?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17082796
Well have you got the components for EasyPDF or whatever it is?

I can't imagine the same code will work with Acrobat.

(FWIW there's a link in that question to the code for AddFilterItem and CommonFileOpenSave)
0
 

Author Comment

by:dmpuser
ID: 17082922
Wath is Easypdf components ????

0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17082929
You've posted another question - regarding the AddFilterItem and CommonFileOpenSave... I mentioned there's a link in that question I referenced...
That other question may or may not get deleted. :-S

But the code mentioned earlier will require you to investigate if EasyPDF costs - or if you can get it easily enough.
0
 
LVL 38

Assisted Solution

by:puppydogbuddy
puppydogbuddy earned 166 total points
ID: 17084210
If you can't resolve the above, here is an alternative that has gotten great reviews from everyone I have recommended it to.  It is code that is placed in your application as a standard module, and just requires a simple call statement to work.  See these links:

        Background info (see final post by asker)
                     http://www.experts-exchange.com/Databases/MS_Access/Q_21908186.html

       The download site:          
             http://www.lebans.com/reporttopdf.htm


0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 166 total points
ID: 17085221
I had this bookmarked but at home
so here it is


PDFTK Pdf Concatenator is a 100% freeware software which is simple to use.
You can download the windows version software from here:

http://www.pdfhacks.com/pdftk/pdftk-1.12.exe.zip

0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17086605
lol Pdf Concatenator.

New - Evostick Super Concatenating liquid.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17088016
hence the site pdfHACKS ha!
0
 

Author Comment

by:dmpuser
ID: 17088266
I just have adobe professional in my society but I need to merge two or tree files PDF without interact with the Access application .
0
 

Author Comment

by:dmpuser
ID: 17088499
LPurvis .....What is the link you have mentioned ?????????
0
 

Author Comment

by:dmpuser
ID: 17088529
Lpurvis Can you repeat what are steps I must to follow to create and merge two file pdf automatically whitout my interacting and using a access code???
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17088741
The code I linked to is merely my reworking of code from the EasyPDF website.
It requires that you have EasyPDF.  (I don't know how obtainable it is - i.e. how much :-S)

If it costs serious wonga - then you have other links here anyway - pointing you to other (free) sources of software that you can control to concatenate your files together.
0
 

Author Comment

by:dmpuser
ID: 17088771
Ooooookkkkkkk I have download easypdfsdk trial version (30 dayS) and I Have merged two files pdf....but now You can suggest me how I can create the file pdf without my interact???? using the same component (easypdfsdk) ????

0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17088793
Oh OK. <surprised expression>
You've got that and installed it...?

Umm then if you get the code for AddFilterItem and CommonFileOpenSave from http://www.mvps.org/access/api/api0001.htm and paste that into a new module (if you haven't done so already).

Then running that code see if it prompts you for the file you want to Join etc and produces an output.

(Bear in mind it's a trial you have - the suggested links by the others should be free forever :-)
0
 

Author Comment

by:dmpuser
ID: 17088879
I have rem the line AddFilterItem and CommonFileOpenSave to bypass the problem and go on with my test but now I must generate a pdf from my tree  Access reports !
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17088894
You're wanting to create one PDF from three separate reports?
Are these reports already exported as files?  You've been talking thus far about Joining separate PDF files...

Remove rem on those lines - and put in the code as suggested to let the procedure run as an example to you.
0
 

Author Comment

by:dmpuser
ID: 17088928
Now, Infact, I must trasform my tree Access report in pdf file nut automatically without window form
0
 

Author Comment

by:dmpuser
ID: 17088931
but and not NUT
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17088956
So your requirements have become to generate one PDF - that is the result of three reports.
Without a window form?  (huh?)
You mean without previewing?
Without opening Access?
(Or just without navigating to the files - having output your three reports to PDFs before then?)
0
 

Author Comment

by:dmpuser
ID: 17088981
If I trasform each one of tree reports in pdf files I must put the name of the file for each pdf i want to create and I don't want the interact of the user
0
 

Author Comment

by:dmpuser
ID: 17088994
Finally I must create one file pdf from tree  or more reports of my access application WITHOUT the interact of the user
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089008
OK then - so you know where you've exported your reports to?
(i.e. you have the full file names?)

Then in the example code - instead of using the common dialog to add files you would fill them yourself...

So instead of the block beginning
 ' Accumulate PDF files until user cancels.

You'd just have
 ' Accumulate PDF files without user intervention.
  files.Add ("C:\YourPath\YourFIle1.pdf")
  files.Add ("C:\YourPath\YourFIle2.pdf")
  files.Add ("C:\YourPath\YourFIle3.pdf")
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089016
But have you considered trying to use the separate reports as subreports on another new master?
Slot them in - put page breaks in between and just print that big one.
It might look alright (or might look like a pile of shrubbish). :-D
0
 

Author Comment

by:dmpuser
ID: 17089050
I insert the page break but the second report doesn't appends to the first !!!

In the later day I have try this operation but I have immediately abandoned this solution
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089056
How do you mean it doesn't append?
When you print it out/preview it - the second subreport never appears?
0
 

Author Comment

by:dmpuser
ID: 17089064
Is there a metod to append two access reports?????

can you suggest me?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089075
Umm just what I was suggesting... create a new blank report and insert the other desired ones as subreports. (With a page break between the subreports).

(Bear in mind that you won't get your report header sections appearing when run as subreports - so it might not look right - it might need fiddling with or might never look right - but it's another option.)

For what it's worth - you should also still be able to concatenate separate output files now
If I were you - I'd probably investigate both methods. :-)
0
 

Author Comment

by:dmpuser
ID: 17089122
I have create a new report without report  header and I have copied the two reports but I don't handstand how I can go on to separate the recordsource of the tho distinct report !!!!
0
 

Author Comment

by:dmpuser
ID: 17089295
in this moment I am finding another way to make this work...
I create the report pdf with Adobe designer and I put in pdf file all of the Access fields using a sql connection .
My problem is that when I try to view the preview of the merge pdf-sql I receive the error "....is not a trusted connection" and I can see only the first field !
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089313
Have never merged live data to a pdf :-S
Didn't know you could - not sure I'd want to.
Sorry, can't help. :-(

Have you fully explored the other two methods?
Or are you exploring all three simultaneously?
Or putting all your eggs in this basket.

Are these reports of yours all very different?
The fact that you're trying to merge data as a solution implies to me that they have the same structure - but just different records returned... that's not the case though is it?
0
 

Author Comment

by:dmpuser
ID: 17089360
The tree reports are differents both in the structure and table source

0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17089403
OK - then I don't particularly see what your merge solution is - but hope it goes well.

Anyone else care to comment?
Yes - you lot up there looking down... :-p
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17089549
Leigh,
Just got up.  Can't believe you have been on this for hours.   I suggest you give the Lebans solution a try like I recommended earlier.  Three out of three I recommended it to rave about it.  Lebans provides code for you to install as a standard module in Access and one line of code to call the module.....and that's it.  It assumes you have a postscript printer.

Here is the short version. Please go to http://www.lebans.com/reporttopdf.htm and look at his example.  

-----------------------------------------------------------------------------------------------------
Dim blRet As Boolean
blRet = ConvertReportToPDF("Order Form", vbNullString, "Order Form" & ".PDF", False)
-----------------------------------------------------------------------------------------------------
                                                 #1                                     #2                #3

Explination of above.
#1 = Report Name
#2 = Exported PDF name
#3 = adds the PDF extension

Hope this helps.
0
 

Author Comment

by:dmpuser
ID: 17090531
I have download the tree files dll and mdb file and I have copied dll files in system32 dir

I start the mdb But when I choice the report to convert and click over the button control I receive the msg.....The object output format is not evaiable!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17090822
Did you delete your prior pdf code before installing the Leban's Version?
Did you read and follow the instructions in the readme file?
Is your printer a postscript printer (i.e. is it driven by a postscript printer driver)?
Did you place the standard module code in a public procedure?
Post your module code and the code you use to call the module.
0
 

Author Comment

by:dmpuser
ID: 17090973
I have created a new form and  I call the function..........

Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = True, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean

With the control button ......

Dim blRet As Boolean
' Call our convert function
' Please note the last param signals whether to perform
' font embedding or not. I have turned font embedding ON for this example.

Call ConvertReportToPDF(Me.lstRptName, vbNullString, _
Me.lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

but I don't have copied the two modules modReportToPDF and clsCommonDialog in the new project that I have created.it Is necessary?
0
 

Author Comment

by:dmpuser
ID: 17090988
For printer selection I have select the "Adobe PDF"
0
 

Author Comment

by:dmpuser
ID: 17091262
the exact  error is ...snapshottoPDF 2282 ...The object output format is not available
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17091434
Try the syntax this way for now:
Call ConvertReportToPDF(Me!lstRptName,vbNullString , _
Me!lstRptName.Value & ".pdf", False)

If the above did not work, try this way:
Call ConvertReportToPDF(Me!lstRptName,  , _
Me!lstRptName.Value & ".pdf", False)


If neither of the above work:

Did you delete the prior DLL before installing the Lebans code?


<<<<but I don't have copied the two modules modReportToPDF and clsCommonDialog in the new project that I have created.it Is necessary?>>>>

Were these modules included in the Leban's download package to be installed as instructed as per the readme file?  If the answer is yes, then you must delete the prior code and install as instructed.  Do not take any shortcuts.

 
0
 

Author Comment

by:dmpuser
ID: 17091549
neither of two lines go on

which DLL I must to delete? ??????

Were these modules included in the Leban's download package to be installed as instructed as per the readme file?  If the answer is yes, then you must delete the prior code and install as instructed.  Do not take any shortcuts.

I haven't handstand this
0
 

Author Comment

by:dmpuser
ID: 17091626
in the readme file there is a line .....must supply full path and file name...what means???
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17091650
<<<neither of two lines go on>>>>  What was error message?

which DLL I must to delete? ?????? DLL for any prior pdf converter you may have installed

Were these modules included in the Leban's download package to be installed as instructed as per the readme file?  If the answer is yes, then you must delete the prior code and install as instructed.  Do not take any shortcuts.

I haven't handstand this
<<<<but I don't have copied the two modules modReportToPDF and clsCommonDialog in the new project that I have created.it Is necessary?>>>>

0
 

Author Comment

by:dmpuser
ID: 17091715
the same message I have related up

I have installed another converter but not manually so I ignore which are dll eventually installed
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17091783
path is the directory path for the document on your computer

         C:\XXXX\XXXXX\XXXXX.pdf

filename is the name of your file......you already provided that


Try the call statement you had originally, but include the full path
0
 

Author Comment

by:dmpuser
ID: 17091819
where I put the full path??????

I don't think may be the real problem!
0
 

Author Comment

by:dmpuser
ID: 17091825
this is the error

snapshottoPDF 2282 ...The object output format is not available
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17091915
Code your path like this:

Call ConvertReportToPDF(Me!lstRptName, vbNullString, _
"C:\Your Path" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17092937
dmpuser,

Is it working, now?  Let me know status, please.  
0
 

Author Comment

by:dmpuser
ID: 17097145
snapshottoPDF 2282 ...The object output format is not available

Is the same error ........................

my path "c:\"
0
 

Author Comment

by:dmpuser
ID: 17097278
The error is in the line

' Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
       strPathandFileName
    ' Make sure the process has time to complete


of the module MODREPORTTOPDF

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097385
You are getting the error because the code requires that you have MicroSoft's Snapshot Viewer installed and you don't have it.  See the following link for download instructions:

   http://www.microsoft.com/downloads/details.aspx?FamilyID=b73df33f-6d74-423d-8274-8b7e6313edfb&DisplayLang=en




         
0
 

Author Comment

by:dmpuser
ID: 17097466
I have installed the ver 10 of snapshot but the error do not change ! :-((((

Is there any component in my access Reference that I must adding?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097499
Yes. Go to the VB editor and select Tools>References>Snapshot Viewer Control.
0
 

Author Comment

by:dmpuser
ID: 17097536
well!

I am trying with two access application:

One is the your MDB file (download from internet) and one Is the same form and code but In one of my access Porject (adp)
So in my access ADP the component "Snap shot viewer control" is visible but in your mdb This component is not visible

however in my ADP project (with snapshot control)  The error is the same!!! :-((((((((((
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097752
I am not familiar with an access project adp file, but snapshot should work the same...I
_____________________________________________
<<<<Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
  strPathandFileName>>>>>>

1.  the appropriate syntax for snapshot format is >>>>>acFormatSNP<<<<<<<
so substitute this syntax where it says "SnapshotFormat(*.snp)"

If this doesn't fix the above, please post the entire string that you have for the DoCmd.OutputTo

2. In the mdb that you are using, you need to recheck the references it should show a missing reference to the snapshot viewer control now that you have an error.  
0
 

Author Comment

by:dmpuser
ID: 17097798
I have rem the entire string .....DoCmd.OutputTo and the error now is "Sorry cannot decompress snapshot file, try with another report"

2) How can Add a new component (snap shot control) in your mdb application?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17097880
Hey PDB - Just got up.  Can't believe you have been on this for hours.
;-)

At least the question's staying on one track now.
:-S
0
 

Author Comment

by:dmpuser
ID: 17097905
HELP ME...LPURVIS!!!!!!!!!!!!!!!!!!!!
0
 

Author Comment

by:dmpuser
ID: 17097917
MY COMPANY HAS ASSIGN ME A PROJECT AND THE HEART OF HIM IS BASED ON THIS PROBLEM!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097918
1. don't rem it out, but use acFormatSNP for snapshot format

2. go  to vb editor tools>references> browse> .ocx >snapview.ocx
should be in c:\program Files\Common Files\System\snapview.ocx
if not there, download again, recheck references
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097933
Leigh,
LOL!!! That will teach me to open my big mouth.
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17097934
I can only sympathize at how it's going.  (Been here before myself PDB - the issues that never end).
I'm sure PDB will get you there dmpuser.
0
 

Author Comment

by:dmpuser
ID: 17097952
oK

i HAVE INSERT THE NEW COMPONENT SNAPSHOT.OCX

i HAVE SOBSTITUTE
 THE ........................"SnapshotFormat(*.snp)".......... WITH........ acFormatSNP...................... IN YOUR MDB FILE

BUT THE ERROR IS THE SAME :-(((((((((((
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17097995
1. Recheck references..Is snapview checked off or missing?
2. Post the entire line of your do.cmd outputto code so i can check the format/syntax
0
 

Author Comment

by:dmpuser
ID: 17098023
1) I HAVE SELECT HIM
2) WHAT MEAN .....POST ?????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17098073
copy it and paste it here so i can see it.

also, if i remember correctly, the snapshot download has two files...the ocx file and the snapshot viewerapplication file.....do you have both files in the mdb?
0
 

Author Comment

by:dmpuser
ID: 17098103
DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName


I have installed the snapshot program and I have added the component ocx in access mdb ......is there something else to do?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17098131
no, shouldn't be.  Do references show as being checked off???

<<<<DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName>

post your actual string with your actual file/report name
0
 

Author Comment

by:dmpuser
ID: 17098179
if checked mean .....selected ...then yes, I have "flag" the "snapshot view control"

I have display the
acOutputReport and  RptName values and I have received the value "3" and "DrawBoxwithMargin"
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17098211
Will you please post your entire DoCmd.outputto so that I can see it.....and for test purposes use the return values instead of the variables in the syntax.
0
 

Author Comment

by:dmpuser
ID: 17098229
12 If Len(SnapshotName & vbNullString) = 0 Then
     
    ' Make sure we were passed a ReportName
13    If Len(RptName & vbNullString) = 0 Then
        ' No valid parameters - FAIL AND EXIT!!
14        ConvertReportToPDF = ""
        Exit Function
15    End If
       
    ' Get the Systems Temp path
    ' Returns Length of path(num characters in path)
16    lngRet = GetTempPath(Pathlen, strPath)
    ' Chop off NULLS and trailing "\"
17    strPath = Left(strPath, lngRet) & Chr(0)
   
    ' Now need a unique Filename
    ' locked from a previous aborted attemp.
    ' Needs more work!
18    strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
 MsgBox strPathandFileName
    ' Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName
    ' Make sure the process has time to complete
20     DoEvents

Else
21     strPathandFileName = SnapshotName
 
End If
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17098321
<<<<<DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName>>>>

Change this line back to the way it was originally.  I meant for you to change it in the call statement. Do not modify Leban's code, except as he instructed in the readme file..

Please post your call statement...the one you issue from your command button.

By the way, you did put Leban's code in a central standard module, and not with your button/form code, didn't you??
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17098376
Purvis,
Help!!! I am going to bed....seems like everything is working, except snapshot viewer. Can't seem to get him over the hump on that part. He says references are ok.
0
 

Author Comment

by:dmpuser
ID: 17099765
the read me file show this text.....wath means?

ReportToPDF
Copyright Lebans Holdings 1999 Ltd
Developed and tested under Access 97 through A2003.

The PDF Library file "DynaPDF.dll" and the file "StrStorage.dll" can be located in the same folder as the ReportToPDF.mdb file or in your Windows\System32 folder. The simplest and preferred method is to copy these 2 files into your System32 folder. The DynaPDF.dll file and the StrStorage.dll are NOT ActiveX files. They DO NOT require Registration or References to be set to them.

The StrStorage DLL exposes one function.
Public Function ConvertUncompressedSnapshotToPDF( _
UnCompressedSnapShotName As String, _
OutputPDFname As String = "", _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "" _
Optional PasswordOpen As String = "" _
Optional PasswordRestrictions as Long = 0 _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean

You must supply the full path and filename. Exporting your Report to Snapshot format and then decompressing the Snapshot file is handled by functionality exposed within this MDB. Please open the HowToUse form and examine the code behind the CommandButton controls.
0
 

Author Comment

by:dmpuser
ID: 17099793
sorry ....what means?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17099866
Sorry I've not been following lol
Just checked in by pure chance.

Why are we using snapshot viewer now?
Converting from a snapshot to a PDF?
Why?
Is that what Stephen Lebans example does?
0
 

Author Comment

by:dmpuser
ID: 17099906
I don't know purvis....ask to PDB
0
 

Author Comment

by:dmpuser
ID: 17099910
is the Lebans's code to do it
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17100241
Leigh,
I just got up briefly.  I keep asking if he followed/installed everything on Leban's readme file.  He says yes, but from the last question he asked, it looks like he did not copy the DynaPDF.dll or the strStorage.dll files to his system32 folder.  As I understand the Leban's code, an Access report is indeed output to Snapshot and converted from snapshot to pdf.  This is done because rtf format strips the lines and can't be used to convert to pdf.  So, it looks like he just needs to follow the instructions in the readme file and copy those dll files over to system32.  Well, back to sleep.
0
 

Author Comment

by:dmpuser
ID: 17100374
LPurvis you also back to sleep like PDB ????
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17100434
Not physically.

If PDB has his doubts then can you go through the readme once more - confirming you've done each and every part exactly as it describes.

And you have your paths right?
0
 

Author Comment

by:dmpuser
ID: 17100471
I have only copied the two files dll in windows32 dir

Is there something else to do?
0
 

Author Comment

by:dmpuser
ID: 17106266
Get up !!!!!!!!!!!
0
 

Author Comment

by:dmpuser
ID: 17106676
Heiiiiiiii !!!!!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17106784
dmpuser,
I am here. I see you still have not got it working.

In reviewing what you have done....the following code belongs in a standard module, not a form module.

<<<<<I have created a new form and  I call the function..........>>>>>>>>

Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = True, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean


2.the call statement code behind your button should look like this:Fill in your actual path

Dim blRet As Boolean
blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
"C:\Your Path" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

0
 

Author Comment

by:dmpuser
ID: 17106808
So I have copied both two dll and my adp in c:\ and I have assign to my button the code

Dim blRet As Boolean
blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
"C:\Your Path" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

and the function ConvertReportToPDF is on the standard module and not in my form
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17106852
"C:\Your Path" & Me!lstRptName.Value & ".pdf",
^^^^^^^^^^

Put the actual path to your file (where you want to save on your computer)
0
 

Author Comment

by:dmpuser
ID: 17106861
Sorry....I have just put C:\ between the quotation mark
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17106901
well, what happens when you run it????
0
 

Author Comment

by:dmpuser
ID: 17106919
the error is:

snapshottoPDF 2282 ...The object output format is not available...
 error in line 19


and the  code is...


12 If Len(SnapshotName & vbNullString) = 0 Then
     
    ' Make sure we were passed a ReportName
13    If Len(RptName & vbNullString) = 0 Then
        ' No valid parameters - FAIL AND EXIT!!
14        ConvertReportToPDF = ""
        Exit Function
15    End If
       
    ' Get the Systems Temp path
    ' Returns Length of path(num characters in path)
16    lngRet = GetTempPath(Pathlen, strPath)
    ' Chop off NULLS and trailing "\"
17    strPath = Left(strPath, lngRet) & Chr(0)
   
    ' Now need a unique Filename
    ' locked from a previous aborted attemp.
    ' Needs more work!
18    strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
 MsgBox strPathandFileName
    ' Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName
    ' Make sure the process has time to complete
20     DoEvents

Else
21     strPathandFileName = SnapshotName
 
End If
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17106963
<<<So I have copied both two dll and my adp in c:\ >>>
did you put two dll in system32 folder??
___________________________________________________
take this line out of button code and make a public variable n the standard module with the function

<<<<<Dim blRet As Boolean>>>>

Public blRet As Boolean
_____________________________________________

Check references on Snapshot

Run again
0
 

Author Comment

by:dmpuser
ID: 17106995
yes I have just copied two dll in w32 dir

The error say that the problem is in the snapshot and not in Public blRet As Boolean
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17107037
<<<<19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName                                           ^^^^^^^^^^^^>>>>>>>

Change acFormatSNP back to what Leban's had in his original code.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17107073
change back to this:

<<<<Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
  strPathandFileName>>>>>>

0
 

Author Comment

by:dmpuser
ID: 17107236
I have just modify the line!!!!!!!!!!
0
 

Author Comment

by:dmpuser
ID: 17107278
I try to print the  strPathandFileName value and  I receive this path

c:\docume....\visconti\impost.....\temp\snpdb.snp

 is ok???
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17107567
Can't tell until you execute code....and tell me what happened.
0
 

Author Comment

by:dmpuser
ID: 17107589
the error is:

snapshottoPDF 2282 ...The object output format is not available...
 error in line 19


and the  code is...


12 If Len(SnapshotName & vbNullString) = 0 Then
     
    ' Make sure we were passed a ReportName
13    If Len(RptName & vbNullString) = 0 Then
        ' No valid parameters - FAIL AND EXIT!!
14        ConvertReportToPDF = ""
        Exit Function
15    End If
       
    ' Get the Systems Temp path
    ' Returns Length of path(num characters in path)
16    lngRet = GetTempPath(Pathlen, strPath)
    ' Chop off NULLS and trailing "\"
17    strPath = Left(strPath, lngRet) & Chr(0)
   
    ' Now need a unique Filename
    ' locked from a previous aborted attemp.
    ' Needs more work!
18    strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
 MsgBox strPathandFileName
    ' Export the selected Report to SnapShot format
19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName
    ' Make sure the process has time to complete
20     DoEvents

Else
21     strPathandFileName = SnapshotName
 
End If
0
 

Author Comment

by:dmpuser
ID: 17107598
with acFormatSNP back to "SnapshotFormat(*.snp)",
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17107627
<<<19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName>>>>>>

You did not change <<<acFormatSNP>>> like I requested.
0
 

Author Comment

by:dmpuser
ID: 17107660
just yesterday I have back to "SnapshotFormat(*.snp)" but the error is the same!!!!!!!!!!!!!!!!!!!!!!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17107936

1. Try printing an Access report to the snapshot viewer directly using this syntax behind a new button

 DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

0
 

Author Comment

by:dmpuser
ID: 17108071
the error is:

snapshottoPDF 2282 ...The object output format is not available...
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17108098
Then you don't have a good install of snapshot. You need to reinstall.

When I installed Snapshot on my computer, the following files were installed in additon to the ocx file. Do you have them on your computer???

File List
---------

The following files are installed by Snpvw90.exe in the Program Files\Snapshot Viewer folder by default:

    Readme.txt
    Snapview.cnt
    Snapview.exe
    Snapview.hlp
0
 

Author Comment

by:dmpuser
ID: 17108122
I see that the help of  acOutputReport say that there are two other  parameters....template file and encoding

wath about?????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17108178
Wait a minute...did you create a new button for printing just snapshot like I asked?
THe message
snapshottoPDF 2282 ...The object output format is not available...

is a pdf error message not a snapshot message
0
 

Author Comment

by:dmpuser
ID: 17108184
In my disk the situation is that snapshot is installed under

C:\Programmi\Snapshot Viewer

and their files are snapview.exe and snapview.cnt Snapview.hlp  Readme.txt
and a dir setup
0
 

Author Comment

by:dmpuser
ID: 17108226
and then?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17108279
<<<<I see that the help of  acOutputReport say that there are two other  parameters....template file and encoding ......wath about?????>>>>>

They are optional parameters; don't worry about that for now....just create the print to snapshot button like I asked.

New button: Print to snapshot

Button code:
 DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

test button see if it generates access report n snapshot mode
0
 

Author Comment

by:dmpuser
ID: 17108350
Do you receive or read my msg??????

I have just create a new button and this code but the error is the same!!!!!!!!!!!!!
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17108393
From PDF to Snapshot! I thought I had better contribute again as this is post is spamming my inbox :)

dmpuser

Did u try pdftk? I posted the link to it?

In that zip file is help files plus a executable

In C:\EE I put that exe in along with aa.pdf bb.pdf
and ran this

pdftk aa.pdf bb.pdf output f.pdf

and it merged a.pdf and b.pdf successfully

Do note, the file u are merging to i.e. f.pdf, it must not exist

Ok, now in VBA, to answer your original question

I ran this

    Shell ("c:\ee\pdftk.exe c:\ee\aa.pdf c:\ee\bb.pdf c:\ee\f.pdf output c:\ee\dd.pdf")

and it merged aa.pdf, bb.pdf and f.pdf successfully and produced one file called dd.pdf


I believe this is what u may be looking for based on your original question? unless of course your requirements have changed

0
 

Author Comment

by:dmpuser
ID: 17108441
No Your solution is the best if I must merge more than one files but My problem is to merge more than one Access report without user interaction
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17108444
why are you getting a pdf error message from printing to snapshot??
snapshottoPDF 2282 is not a snapshot error message

if you did what i asked, then snapshot is not working.  You have a bad install of snapshot viewer....you need to reinstall.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17108596
ok then dmpuser
I leave u in the capable hands of PDB
I dont think u need my help so Im  unsubscribing
Good luck
0
 

Author Comment

by:dmpuser
ID: 17108665
Thank you Rock....I'll Ask you for other problem
0
 

Author Comment

by:dmpuser
ID: 17108911
:-(((((((((((((((( Help me!!!!!!
0
 

Author Comment

by:dmpuser
ID: 17108940
You say me why My snapshot open all of the files I have in my pc but You still say that my snapsho have a problem???????????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17109114
Look, if you followed my instructions you should have 2 button, one for print to pdf, and one for print to snapshot.

You told me that when you click the print to snapshot (containing the code I gave you), you get error snapshottoPDF 2282.  This is not a snapshot error message,it is a pdf error message from Leban's code....So either you did not create the Snapshot button ......or Snapshot is not working.......which is it????  

And now you tell me <<<My snapshot open all of the files I have in my pc<<<<<<

which is it  error 2282 or snapshot is working?????? You tell me.

 
0
 

Author Comment

by:dmpuser
ID: 17119972
<<you should have 2 button, one for print to pdf, and one for print to snapshot>>

I never didn't use this second button!!!!!!!!!!!
however Now
I have look for a file snp and I have convert him to a pdf file using the second button "select a snapshot to save as pdf"

all is gone ok!!!!
0
 

Author Comment

by:dmpuser
ID: 17120293
ehiiiii!!!!!! get up!!!!!
0
 

Author Comment

by:dmpuser
ID: 17120648
.......
0
 

Author Comment

by:dmpuser
ID: 17121231
PDB !!!!!!!!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121262
I am here!!  Did you create that 2nd button??
0
 

Author Comment

by:dmpuser
ID: 17121276
Yes
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121290
Before you can print pdf, you've got to be able to print a snapshot.  Is the snapshot button working??
0
 

Author Comment

by:dmpuser
ID: 17121306
I have used one of my snp file and I have tried to convert him to pdf with your second button.....All is gone OK!!!!!!
0
 

Author Comment

by:dmpuser
ID: 17121356
the error appear when I try to save a report as snapshot ?!?!?!?!!?
0
 

Author Comment

by:dmpuser
ID: 17121370
.....with the first button
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121377
So snapshot is not working???? what error are you getting??? and post the code behind your snapshot button.
0
 

Author Comment

by:dmpuser
ID: 17121452
' Save the Snapshot file as a PDF document.
Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)
 

This is the code of second button "select a snap to save as pdf" and if I click on this button and select a file snp
this file is converted in a file pdf withou problem.

<<So snapshot is not working???? what error are you getting??? >>

Waht do you meant about this question????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121552
For the last time, if you don't follow instructions.....I am done. The code you provided is for the PDF button, not the snapshot button.

The code behind your snapshot button should be as follows:

Button code:
 DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

0
 

Author Comment

by:dmpuser
ID: 17121636
<< and post the code behind your snapshot button>>

then tell me the label of snapshot button plese!!!!!!!!!! I am Italian and I dont' write and comprise very well the english !!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121698
<<<tell me the label of snapshot button>>>>>   Print Snapshot

After you place the code I gave you behind the button, test the button and tell me what happens.
0
 

Author Comment

by:dmpuser
ID: 17121734
I don't have a button that is name or label is "Print Snapshot" I have only 2 button:

"Click Here to Save this Report as a PDF document"

the code is.......


Private Sub cmdReportToPDF_Click()
' Save the Report as a PDF document.
' The selected report is first exported to Snapshot format.
' The Snapshot file is then broken out into its
' component Enhanced Metafiles(EMF), one for each page of the report.
' Finally, the EMF's are converted to PDF pages within the master
' PDF document.

' The function call is:
'Public Function ConvertReportToPDF( _
'Optional RptName As String = "", _
'Optional SnapshotName As String = "", _
'Optional OutputPDFname As String = "", _
'Optional ShowSaveFileDialog As Boolean = False, _
'Optional StartPDFViewer As Boolean = True, _
'Optional CompressionLevel As Long = 0, _
'Optional PasswordOwner As String = "", _
'Optional PasswordOpen As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0 _
') As Boolean

' RptName is the name of a report contained within this MDB
' SnapshotName is the name of an existing Snapshot file
' OutputPDFname is the name you select for the output PDF file
' ShowSaveFileDialog is a boolean param to specify whether or not to display
' the standard windows File Dialog window to select an exisiting Snapshot file
' CompressionLevel - not hooked up yet
' PasswordOwner  - not hooked up yet
' PasswordOpen - not hooked up yet
' PasswordRestrictions - not hooked up yet
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF. If you are
' using ONLY - any of the standard Windows fonts
' using ONLY - any of the standard 14 Fonts natively supported by the PDF spec
'The 14 Standard Fonts
'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
'independent whether they're embedded or not.
'Family name PostScript name Style
'Courier Courier fsNone
'Courier Courier-Bold fsBold
'Courier Courier-Oblique fsItalic
'Courier Courier-BoldOblique fsBold + fsItalic
'Helvetica Helvetica fsNone
'Helvetica Helvetica-Bold fsBold
'Helvetica Helvetica-Oblique fsItalic
'Helvetica Helvetica-BoldOblique fsBold + fsItalic
'Times Times-Roman fsNone
'Times Times-Bold fsBold
'Times Times-Italic fsItalic
'Times Times-BoldItalic fsBold + fsItalic
'Symbol Symbol fsNone, other styles are emulated only
'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only


' You must pass either RptName or SnapshotName or set the ShowSaveFileDialog param to TRUE.
' Any file names you pass to this function must include the full path. If you only include the
' filename for the output PDF then your document will be saved to your My Documents folder.
 

Dim blRet As Boolean
' Call our convert function
' Please note the last param signals whether to perform
' font embedding or not. I have turned font embedding ON for this example.
'Call ConvertReportToPDF(Me!lstRptName, , _
'Me!lstRptName.Value & ".pdf", False)

blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
"C:\" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)


'Call ConvertReportToPDF(Me.lstRptName, vbNullString, _
'Me.lstRptName.Value & ".pdf", False, True, 0, "", "", 0, 0)
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.

End Sub

and a button "Click Here to Select a Snapshot to Save as a PDF document"

and the code is...

Private Sub cmdSaveSnap_Click()
' Save the Snapshot file as a PDF document.
Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)

End Sub



0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17121844
Where did all of this code come from?  Some of this code........until now  have not seen it before.  One more time:
Follow instructions , you should have the following:

1. standard module with Leban's central module code.
2. print snapshot button (with code I gave you>>>>>DoCmd.............,etc.).
3. print pdf button with Leban's button code (blReturn...........,etc.)

Create the print snapshot button with the code I gave you.
0
 

Author Comment

by:dmpuser
ID: 17121936
I have create a button with code

DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

and I have click on the button.....the error is "run time error 2282 The object output format is not available..."


give me a link where download your mdb, perhaps I have the mdb of another one ?
0
 

Author Comment

by:dmpuser
ID: 17121960
the standar name of module is "modreporttopdf"  ???
0
 

Author Comment

by:dmpuser
ID: 17122063
is this one the right link?


http://www.lebans.com/reporttopdf.htm
0
 

Author Comment

by:dmpuser
ID: 17122135
ok tanks a lot !
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17122155
yes ...modreporttopdf; yes link is correct

I think the problem is that some of the code that should be in the standard module you have in the button.

I am going to repeat the button code......any other code goes in standard module.  Move out from button code to standard module.

Buttons:
Print snapshot
           DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

Print PDF
          Dim blRet As Boolean
         blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
         "C:\" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

The above should be your button code.....any other code should be in standard module because it is called by both buttons.Understand??????
0
 

Author Comment

by:dmpuser
ID: 17122227
I also repeat the same :

1) I have create a NEW button only with code
DoCmd.OutputTo acOutputReport, Me!lstRptName, acFormatSNP, _
                "c:\" & Me!lstRptName & ".snp", False

2) and a second NEW button with code
Dim blRet As Boolean
         blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
         "C:\" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

CLICKING OVER THE BUTTON WITH (1) CODE i RECEIVE THE ERROR "run time error 2282 The object output format is not available..."

CLICKING OVER THE BUTTON WITH (2) CODE I RECEIVE THE ERROR "snapshottoPDF 2282 ...The object output format is not available..."
Understand??????



0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17122267
You did not completely follow instructions:
The above should be your button code.....<<<<any other code (that was in your button codee) should be moved to standard module because it is called by both buttons.

0
 

Author Comment

by:dmpuser
ID: 17122355
the only code that I have in a button is:
Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)

You say me to create a button with only code:
Dim blRet As Boolean
         blRet = ConvertReportToPDF(Me!lstRptName, vbNullString, _
         "C:\" & Me!lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)

It's ok??????

and I must copy this code down in standard module ???

Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)


How I must define this code in standard module?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17122534
To make things easier:
1. Rename current standard module to ......ModuleOld
2. take leban's code and paste to new standard module
3.From new standard module, just remove only the code that you already have in the new buttons.  Leave remainder of code in standard module.
4. Compile and test buttons.
0
 

Author Comment

by:dmpuser
ID: 17122635
1) I have rename modreporttopdf in oldmodule,
2) the leban's code that I have paste in new standard module  is only

Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)
3) You see that there isn't any module to remove from new standard module
4) I must rename the new module with name of old?
0
 

Author Comment

by:dmpuser
ID: 17122684
4) when I compile the code I receive the error in fFileDialogSnapshot()

 ....."is invalid out of routine"
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17122734
what happened to this code????

 Save the Report as a PDF document.
' The selected report is first exported to Snapshot format.
' The Snapshot file is then broken out into its
' component Enhanced Metafiles(EMF), one for each page of the report.
' Finally, the EMF's are converted to PDF pages within the master
' PDF document.

' The function call is:
'Public Function ConvertReportToPDF( _
'Optional RptName As String = "", _
'Optional SnapshotName As String = "", _
'Optional OutputPDFname As String = "", _
'Optional ShowSaveFileDialog As Boolean = False, _
'Optional StartPDFViewer As Boolean = True, _
'Optional CompressionLevel As Long = 0, _
'Optional PasswordOwner As String = "", _
'Optional PasswordOpen As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0 _
') As Boolean

' RptName is the name of a report contained within this MDB
' SnapshotName is the name of an existing Snapshot file
' OutputPDFname is the name you select for the output PDF file
' ShowSaveFileDialog is a boolean param to specify whether or not to display
' the standard windows File Dialog window to select an exisiting Snapshot file
' CompressionLevel - not hooked up yet
' PasswordOwner  - not hooked up yet
' PasswordOpen - not hooked up yet
' PasswordRestrictions - not hooked up yet
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF. If you are
' using ONLY - any of the standard Windows fonts
' using ONLY - any of the standard 14 Fonts natively supported by the PDF spec
'The 14 Standard Fonts
'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
'independent whether they're embedded or not.
'Family name PostScript name Style
'Courier Courier fsNone
'Courier Courier-Bold fsBold
'Courier Courier-Oblique fsItalic
'Courier Courier-BoldOblique fsBold + fsItalic
'Helvetica Helvetica fsNone
'Helvetica Helvetica-Bold fsBold
'Helvetica Helvetica-Oblique fsItalic
'Helvetica Helvetica-BoldOblique fsBold + fsItalic
'Times Times-Roman fsNone
'Times Times-Bold fsBold
'Times Times-Italic fsItalic
'Times Times-BoldItalic fsBold + fsItalic
'Symbol Symbol fsNone, other styles are emulated only
'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only


' You must pass either RptName or SnapshotName or set the ShowSaveFileDialog param to TRUE.
' Any file names you pass to this function must include the full path. If you only include the
' filename for the output PDF then your document will be saved to your My Documents folder.
 
0
 

Author Comment

by:dmpuser
ID: 17122808
Sorry but when I show you this code in the first button you have answered me:

<<Where did all of this code come from?  Some of this code........until now  have not seen it before have say me that thi code>>

So I use..only this in standard module ?

' The function call is:
'Public Function ConvertReportToPDF( _
'Optional RptName As String = "", _
'Optional SnapshotName As String = "", _
'Optional OutputPDFname As String = "", _
'Optional ShowSaveFileDialog As Boolean = False, _
'Optional StartPDFViewer As Boolean = True, _
'Optional CompressionLevel As Long = 0, _
'Optional PasswordOwner As String = "", _
'Optional PasswordOpen As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0 _
') As Boolean
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17122944
Yes to standard module, but it has been rem out (commented out). You have to make active, ok??

and this code ...where do you have it??

Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)

blRet = ConvertReportToPDF(vbNullString, sName, sPDF & "PDF", False)
0
 

Author Comment

by:dmpuser
ID: 17123098
the code is inside of one of two button exactly in the button with label "Click Here to Select a Snapshot to Save as a PDF document".You said to me to put this code in the new standard module but now I deleted It because I have compiled with a runtime error; then I compiled the code


Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean

again and I have another error because can't find the function fFileDialogSnapshot that it was called in the button cmdsavesnap and the function it was defined in the old standard module that I renamed as you said to me.

I think that the best way to go on is you send to me the exact code of the standard module (I suppose that the button's codes are ok).Wath do you think about this?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17123200
Standard module....
Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean

Dim blRet As Boolean
Dim sPDF As String
Dim sName As String
sName = fFileDialogSnapshot()

If Len(sName & vbNullString) = 0 Then Exit Sub
' let's use the name of the selected Snapshot file
' to name our converted PDF document.
sPDF = Mid(sName, 1, Len(sName) - 3)
0
 

Author Comment

by:dmpuser
ID: 17123248
I copied this code in the new standard module but the error is in fFileDialogSnapshot

and exactly "sub or function not defined"
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17123389
ok.  I go to lunch now.  Will look over and get back to you later today.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17123941
Are you there?  I went back and looked at the Lebans's mdb, and I see where you have gone wrong.  His code should have been left as is.  You just need to copy over to your adp or mdb, the following objects (as they are)....but before you do this, you need to delete the standard module that you have. Rename your form module with the buttons to FormModuleOld
 
Form:  How to Use.....after  you copy to your mdb or adp....rename it to>> Report Selector

Standard Modules-2:
            1. clsCommonDialog
            2. modReportToPDf

After you have copied these objects over, compile and then test by going to the report selector.
0
 

Author Comment

by:dmpuser
ID: 17128148
Ciaoooo Are you there?
0
 

Author Comment

by:dmpuser
ID: 17128268
Well,I have proceded most easily!
I have used directly the lebans's mdb and I have only rename the form How to use with report Selector but the error is the same.

Is there anithing to do ?
0
 

Author Comment

by:dmpuser
ID: 17128411
Ci sei??????? PDB?????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17128630
Fabio,
I just woke up briefly, it is 5:00 A.M. in the USA EDT, will be going back to sleep....

You are still getting error 2282???

Try this:
1.Go to standard module modReportToPDF, then go to last procedure at the bottom called  Public Function fFileDialogSavePDFname() As String


2. Change this parameter to True
               Optional ShowSaveFileDialog As Boolean = False, _
                                                                             ^^^^^^
3. Compile code and test print

4. Let me know what happened.
0
 

Author Comment

by:dmpuser
ID: 17128688
It's  5 AM????????? BUt you are Strong!!!!!!!

<<Optional ShowSaveFileDialog As Boolean = False, _>>

there isn't it.......

Public Function fFileDialogSavePDFname() As String
' Calls the API File Open Dialog Window
' Returns full path to existing Snapshot File

On Error GoTo Err_fFileDialog

' Call the File Common Dialog Window
Dim clsDialog As Object
Dim strTemp As String
Dim strFname As String

Set clsDialog = New clsCommonDialog

' Fill in our structure
' I'll leave in how to select Gif and Jpeg to
' show you how to build the Filter in case you want
' to use this code in another project.
clsDialog.Filter = "PDF (*.PDF)" & Chr$(0) & "*.PDF" & Chr$(0)
'clsDialog.Filter = "ALL (*.*)" & Chr$(0) & "*.*" & Chr$(0)
clsDialog.hDC = 0
clsDialog.MaxFileSize = 256
clsDialog.Max = 256
clsDialog.FileTitle = vbNullString
clsDialog.DialogTitle = "Please Select a name for the PDF File"
clsDialog.InitDir = vbNullString
clsDialog.DefaultExt = vbNullString



' Display the File Dialog
clsDialog.ShowOpen

' See if user clicked Cancel or even selected
' the very same file already selected
strFname = clsDialog.FileName
If Len(strFname & vbNullString) = 0 Then
' Do nothing. Add your desired error logic here.
End If

' Return File Path and Name
fFileDialogSavePDFname = strFname

Exit_fFileDialog:

Err.Clear
Set clsDialog = Nothing
Exit Function

Err_fFileDialog:
fFileDialogSavePDFname = ""
MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
Resume Exit_fFileDialog

End Function
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17128749
Fabio,
My fault...gave you wrong procedure.....it is about 1/2 way down the module in the proc called Public Function ConvertReportToPDF:

Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _     <<<<<<<<<<<<<<<<<<
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean
0
 

Author Comment

by:dmpuser
ID: 17128819
I have set this parameter to true in the function ConvertReportToPDF in standard module but the file dialog do not appear.....and I receive the error 2282 when I click on the button "Click Here to Save this Report as a PDF document"
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17128891
Fabio,
1.Go back to the procedure and set the parameter back to false. I changed in wrong place.
2. Go to the Report Selector(howtoUse) form module; go tp last procedure at the bottom.
Change parameter from false to true as indicated below.


Private Sub lstRptName_DblClick(Cancel As Integer)
Dim blRet As Boolean
' Call our convert function
blRet = ConvertReportToPDF(Me.lstRptName.Value, vbNullString, Me.lstRptName.Value & ".PDF", False)   '<<<<<<<<<<<<<<<<<<<<Change to true>>>>
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.

End Sub
0
 

Author Comment

by:dmpuser
ID: 17128906
this code is attached to the button "Click Here to Save this Report as a PDF document"

Dim blRet As Boolean
' Call our convert function
' Please note the last param signals whether to perform
' font embedding or not. I have turned font embedding ON for this example.
blRet = ConvertReportToPDF(Me.lstRptName, vbNullString, _
Me.lstRptName.Value & ".pdf", True, True, 0, "", "", 0, 0)
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.

I have just set to true the parameter but The result is the same error 2282
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17129007
That is ok, but you also have to change the following:
. Go to the Report Selector(howtoUse) form module; go tp last procedure at the bottom.
Change parameter from false to true as indicated below.


Private Sub lstRptName_DblClick(Cancel As Integer)
Dim blRet As Boolean
' Call our convert function
blRet = ConvertReportToPDF(Me.lstRptName.Value, vbNullString, Me.lstRptName.Value & ".PDF", False)   '<<<<<<<<<<<<<<<<<<<<Change to true>>>>
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.

End Sub

______________________________________________________________________

Questions:
1.  are you using one of the 14 allowed fonts??
2.You have the two DLL fles in your system 32 folder??
3.Recheck your VB references...go to VB Editor;Select Tools>References......Any references show as "Missng"???  Is reference to Snapshot checked  off???
4. The printer you are using...does it support postscript ???
5.  Does your pc have enough ram memory???
0
 

Author Comment

by:dmpuser
ID: 17129578
two dll are in s32 dir
Now I have installed and checked off the ocx component of snapshot from the dir c:\programs\common files.......but I have see also a snapshot ocx in the dir win\win32\

I have selected the "adobe pdf" printer

ram 512
But the error is the same 2282

where I must look for the 14 fonts?

0
 

Author Comment

by:dmpuser
ID: 17129703
the error is on the standard module ....line 17


Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0 _
) As Boolean


' RptName is the name of a report contained within this MDB
' SnapshotName is the name of an existing Snapshot file
' OutputPDFname is the name you select for the output PDF file
' ShowSaveFileDialog is a boolean param to specify whether or not to display
' the standard windows File Dialog window to select an exisiting Snapshot file
' CompressionLevel - not hooked up yet
' PasswordOwner  - not hooked up yet
' PasswordOpen - not hooked up yet
' PasswordRestrictions - not hooked up yet
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF. If you are
' using ONLY - any of the standard Windows fonts
' using ONLY - any of the standard 14 Fonts natively supported by the PDF spec
'The 14 Standard Fonts
'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
'independent whether they're embedded or not.
'Family name PostScript name Style
'Courier Courier fsNone
'Courier Courier-Bold fsBold
'Courier Courier-Oblique fsItalic
'Courier Courier-BoldOblique fsBold + fsItalic
'Helvetica Helvetica fsNone
'Helvetica Helvetica-Bold fsBold
'Helvetica Helvetica-Oblique fsItalic
'Helvetica Helvetica-BoldOblique fsBold + fsItalic
'Times Times-Roman fsNone
'Times Times-Bold fsBold
'Times Times-Italic fsItalic
'Times Times-BoldItalic fsBold + fsItalic
'Symbol Symbol fsNone, other styles are emulated only
'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only




Dim s As String
Dim blRet As Boolean
' Let's see if the DynaPDF.DLL is available.
blRet = LoadLib()
If blRet = False Then
    ' Cannot find DynaPDF.dll or StrStorage.dll file
    Exit Function
End If

On Error GoTo ERR_CREATSNAP

Dim strPath  As String
Dim strPathandFileName  As String
Dim strEMFUncompressed As String

Dim sOutFile As String
Dim lngRet As Long

' Init our string buffer
strPath = Space(Pathlen)

'Save the ReportName to a local var
mReportName = RptName

' Let's kill any existing Temp SnapShot file
If Len(mUncompressedSnapFile & vbNullString) > 0 Then
    Kill mUncompressedSnapFile
    mUncompressedSnapFile = ""
End If

' If we have been passed the name of a Snapshot file then
' skip the Snapshot creation process below
If Len(SnapshotName & vbNullString) = 0 Then
     
    ' Make sure we were passed a ReportName
    If Len(RptName & vbNullString) = 0 Then
        ' No valid parameters - FAIL AND EXIT!!
        ConvertReportToPDF = ""
        Exit Function
    End If
       
    ' Get the Systems Temp path
    ' Returns Length of path(num characters in path)
    lngRet = GetTempPath(Pathlen, strPath)
    ' Chop off NULLS and trailing "\"
12    strPath = Left(strPath, lngRet) & Chr(0)
   
    ' Now need a unique Filename
    ' locked from a previous aborted attemp.
    ' Needs more work!
15    strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
   
    ' Export the selected Report to SnapShot format
17    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
       strPathandFileName
    ' Make sure the process has time to complete
    DoEvents

Else
18    strPathandFileName = SnapshotName
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17129851
See this link.....problem may have something to do with Access 2002.  Am searching for a fix.  Will get back to you.

            http://www.thescripts.com/forum/thread189064.html
0
 

Author Comment

by:dmpuser
ID: 17129900
Bingo!!!!!!
Now must find the solution!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17129914
0
 

Author Comment

by:dmpuser
ID: 17129952
:-((((((((((((((


"This patch is already present in one of the upgrade just applied"

 the error is persistent
0
 

Author Comment

by:dmpuser
ID: 17130208
I have try to print this two values

MsgBox RptName
     MsgBox strPathandFileName
    ' Export the selected Report to SnapShot format
17    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
       strPathandFileName

and the RptName is the report that I have selected while strPathandFileName is the path and file snp250.snp in the temp dir

the error is the same
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17130279
I am sill looking
Make sure you are using one of these 14 fonts

'The 14 Standard Fonts
'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
'independent whether they're embedded or not.
'Family name PostScript name Style
'Courier Courier fsNone
'Courier Courier-Bold fsBold
'Courier Courier-Oblique fsItalic
'Courier Courier-BoldOblique fsBold + fsItalic
'Helvetica Helvetica fsNone
'Helvetica Helvetica-Bold fsBold
'Helvetica Helvetica-Oblique fsItalic
'Helvetica Helvetica-BoldOblique fsBold + fsItalic
'Times Times-Roman fsNone
'Times Times-Bold fsBold
'Times Times-Italic fsItalic
'Times Times-BoldItalic fsBold + fsItalic
'Symbol Symbol fsNone, other styles are emulated only
'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only
0
 

Author Comment

by:dmpuser
ID: 17130336
PDB!!!!!!!!!!!!!!!!!!!!!! You have found the solution!!!! You are right.......I have start my mdb in one of the pc with access2000 and the pdf is created very well!!!!!!!!!!!!!!!!!!!!!!!!!!!!

0
 

Author Comment

by:dmpuser
ID: 17130370
I must go out office !!!!
See you tomorrow so we go on!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17130407
ok, but remember I am on USA  EDT time.  Time is 10:20 AM.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17130574
Found this on one of the community bulletin boards-Registry error:            
   " I had problem with Snapshot Viewer with the French version. Just an idea
to explore. In the registry basis (regedit), the reference was "Format
Snapshot (*.snp)". Editing all these references as "Snapshot Format
(*.snp)" cured my problems then. If you try this, back up your registry
base first."
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17130666
This looks like the cause and solution for your problem with Snapshot and Access 2002:

                 http://www.kbalertz.com/Feedback_921025.aspx
0
 

Author Comment

by:dmpuser
ID: 17136322
For the first solution I have tried but without important result!

For the second I don't know what he want say
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17137385
Actually, the second may not apply to you unless you installed Microsoft Windows XP Service Pack 2 (SP2) on a computer where Access 2003 was already installed.

CAUSE
This problem occurs because .snp files are associated with Access 2003 after you install Windows XP SP2. Originally, .snp files were associated with the Snapshot Viewer application.
 Back to the top

WORKAROUND
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To work around this problem, follow these steps.1. Click Start, click Run, type regedit, and then click OK.  
2. Locate and then click the following registry subkey:
HKEY_CLASSES_ROOT\.snp
3. Double-click the Content Type registry entry, and then replace the existing value with application/snapview.
0
 

Author Comment

by:dmpuser
ID: 17137506
I have also win xp sp2 access2002
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17137533
Fabio,
Try reinstalling the snapshot viewer from this link.  You may not have gotten all the supporting files on the original download.  

http://support.microsoft.com/default.aspx?scid=kb;en-us;175274
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17137612
Fabip,
This might be the answer: Install Office XP-SP3.....See link

   http://support.microsoft.com/kb/329883/


What do you think???
0
 

Author Comment

by:dmpuser
ID: 17138503
PDB I have speak about this problem with my head clerk (?) and he have saw me that it should be better to change strategy because this method don't give enough reliability (?).

We would want to try other solution for example a merge between a file pdf that contain (in the head) fields from a table sql.

Do you want to help us?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17139215
You should create a new EE post to handle it, but I can you some advice here: Use one of these solutions:
1. The printer driver solution ( it is free):  Installs like a printer, and you select it as your default printer via the Windows control panel.

http://www.softpedia.com/get/Office-tools/PDF/CuteWriter.shtml


2.  The scalable solution (product offerings range from printer driver to pdf creator/editors for network use)

http://www.groupacg.com/     <<my recommendaton if you need more than a pdf writer


http://www.iteksoft.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=1&page=1
   
0
 

Author Comment

by:dmpuser
ID: 17144127
Now we have just download trial version of adobe ver 7 and adobe designer And we have tried to put inside the pdf (SOP in Word format that we have trasform in PDF document).We must merge fields of a table sql with this pdf document...
0
 

Author Comment

by:dmpuser