Solved

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

Posted on 2006-07-11
200
4,591 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
Comment Utility
Hi dmpuser,

Access by itself cannot concatenate PDF files.

Regards,

Patrick
0
 

Author Comment

by:dmpuser
Comment Utility
there is no solutions using access code?
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
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
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Wath is Easypdf components ????

0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
lol Pdf Concatenator.

New - Evostick Super Concatenating liquid.
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
hence the site pdfHACKS ha!
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
LPurvis .....What is the link you have mentioned ?????????
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Now, Infact, I must trasform my tree Access report in pdf file nut automatically without window form
0
 

Author Comment

by:dmpuser
Comment Utility
but and not NUT
0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Is there a metod to append two access reports?????

can you suggest me?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
The tree reports are differents both in the structure and table source

0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
For printer selection I have select the "Adobe PDF"
0
 

Author Comment

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

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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
Comment Utility
in the readme file there is a line .....must supply full path and file name...what means???
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
<<<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
Comment Utility
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
Comment Utility
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
Comment Utility
where I put the full path??????

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

Author Comment

by:dmpuser
Comment Utility
this is the error

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

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
dmpuser,

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

Author Comment

by:dmpuser
Comment Utility
snapshottoPDF 2282 ...The object output format is not available

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

my path "c:\"
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes. Go to the VB editor and select Tools>References>Snapshot Viewer Control.
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
HELP ME...LPURVIS!!!!!!!!!!!!!!!!!!!!
0
 

Author Comment

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

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
Leigh,
LOL!!! That will teach me to open my big mouth.
0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
1) I HAVE SELECT HIM
2) WHAT MEAN .....POST ?????
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
<<<<<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
Comment Utility
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
Comment Utility
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
Comment Utility
sorry ....what means?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
I don't know purvis....ask to PDB
0
 

Author Comment

by:dmpuser
Comment Utility
is the Lebans's code to do it
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
LPurvis you also back to sleep like PDB ????
0
 
LVL 44

Expert Comment

by:Leigh Purvis
Comment Utility
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
Comment Utility
I have only copied the two files dll in windows32 dir

Is there something else to do?
0
 

Author Comment

by:dmpuser
Comment Utility
Get up !!!!!!!!!!!
0
 

Author Comment

by:dmpuser
Comment Utility
Heiiiiiiii !!!!!!!!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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
Comment Utility
"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
Comment Utility
Sorry....I have just put C:\ between the quotation mark
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
well, what happens when you run it????
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
<<<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
Comment Utility
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
Comment Utility
<<<<19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName                                           ^^^^^^^^^^^^>>>>>>>

Change acFormatSNP back to what Leban's had in his original code.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
change back to this:

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

0
 

Author Comment

by:dmpuser
Comment Utility
I have just modify the line!!!!!!!!!!
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
Can't tell until you execute code....and tell me what happened.
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
with acFormatSNP back to "SnapshotFormat(*.snp)",
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
<<<19    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, _
       strPathandFileName>>>>>>

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

Author Comment

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

Expert Comment

by:puppydogbuddy
Comment Utility

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
Comment Utility
the error is:

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

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
and then?
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
<<<<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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you Rock....I'll Ask you for other problem
0
 

Author Comment

by:dmpuser
Comment Utility
:-(((((((((((((((( Help me!!!!!!
0
 

Author Comment

by:dmpuser
Comment Utility
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
Comment Utility
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
Comment Utility
<<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
Comment Utility
ehiiiii!!!!!! get up!!!!!
0
 

Author Comment

by:dmpuser
Comment Utility
.......
0
 

Author Comment

by:dmpuser
Comment Utility
PDB !!!!!!!!!!!
0
 
LVL 38

Expert Comment

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

Author Comment

by:dmpuser
Comment Utility
Yes
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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
Comment Utility
the error appear when I try to save a report as snapshot ?!?!?!?!!?
0
 

Author Comment

by:dmpuser
Comment Utility
.....with the first button
0
 
LVL 38

Expert Comment

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

Author Comment

by:dmpuser
Comment Utility
' 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
Comment Utility
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
Comment Utility
<< 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
Comment Utility
<<<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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
the standar name of module is "modreporttopdf"  ???
0
 

Author Comment

by:dmpuser
Comment Utility
is this one the right link?


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

Author Comment

by:dmpuser
Comment Utility
ok tanks a lot !
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
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
Comment Utility
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??????