Stephan Lebans - Report to PDF installation

  • Thread starter Thread starter SageOne
  • Start date Start date
S

SageOne

Can I install Reports to Pdf if I am on a company server and do not have
permission to access Windows folders?
 
SageOne said:
Can I install Reports to Pdf if I am on a company server and do not have
permission to access Windows folders?

Put the DLLs in the same folder as your FE MDB/MDE on the client work
station. This does not require administrator rights for install.
This also means that you can update the DLLs should Stephen introduce
some new functionality and you do not have to depend on the IT
department to get their thumbs unstuck from their behinds.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
I copied the sample database and (2) Dll files to my folder. The sample
database works just fine and converts the reports to pdf. Here is my new
dilemma:

I looked at the [event procedure] on the command button that stephen has set
to convert a report to a pdf. Where in the event procedure code do I put my
report name that I want to convert to a pdf file? Also, should I copy over
the modules and change any info? Any insight would be greatly appreciated.
 
So if my report name is RptTestResults then I would do the following?

copy and paste two dll's to the folder of my database.

import "ModreprtToPdf" and " ModDocumentSource"

copy and paste this event procedure code into my form:

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 = 150, _
'Optional PasswordOpen As String = "", _
'Optional PasswordOwner As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0, _
'Optional PDFUnicodeFlags 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 - Resolution in DPI(Dots per Inch) to apply to embedded
Images
' PasswordOpen - Users require to Open PDF
' PasswordOwner - Users require to modify PDF
' PasswordRestrictions - Restrictions for viewing/editing/printing PDF - See
modReportToPDF for comments
' 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

' PDFUnicodeFlags controls how each metafile text record is interpreted in
terms
' of Unicode and BiDi language. See modDocumentor for details.
'
' 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.
blRet = ConvertReportToPDF(Me.lstRptName, vbNullString, _
Me.lstRptName.Value & ".pdf", False, True, 150, "", "", 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 change....'Public Function ConvertReportToPDF( _ to 'Public
Function RptTestResults( _



All help is greatly apreciated. Thank you very much.






Stephen Lebans said:
You must import all of the class and code modules from my sample MDB into
your own MDB.

If you look at the code behind the sample form you will see their is a
RptName parameter within the function call.

' 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 = 150, _
'Optional PasswordOpen As String = "", _
'Optional PasswordOwner As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0, _
'Optional PDFUnicodeFlags 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 - Resolution in DPI(Dots per Inch) to apply to embedded
Images
' PasswordOpen - Users require to Open PDF
' PasswordOwner - Users require to modify PDF
' PasswordRestrictions - Restrictions for viewing/editing/printing PDF - See
modReportToPDF for comments
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF.




--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


SageOne said:
I copied the sample database and (2) Dll files to my folder. The sample
database works just fine and converts the reports to pdf. Here is my new
dilemma:

I looked at the [event procedure] on the command button that stephen has
set
to convert a report to a pdf. Where in the event procedure code do I put
my
report name that I want to convert to a pdf file? Also, should I copy over
the modules and change any info? Any insight would be greatly appreciated.




Tony Toews said:
Can I install Reports to Pdf if I am on a company server and do not have
permission to access Windows folders?

Put the DLLs in the same folder as your FE MDB/MDE on the client work
station. This does not require administrator rights for install.
This also means that you can update the DLLs should Stephen introduce
some new functionality and you do not have to depend on the IT
department to get their thumbs unstuck from their behinds.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
I would like to use Stephan's Report to PDF in an Access application I have
for e-mailing ReportCard reports to my suppliers. I have studied the
questions and responses above but I am still confused on how to modify and
use Stephan"s VBA event procedure to execute the code correctly. In the last
response there is an instruxction to cahnge the Public Function
ConvertReportToPDF() to Public Function RptTestResults()? Farther up in the
response it indicated that the name of the report to be converted to PDF is
RptTestResults. Is this really what should be done? It clearly doesn't work
for me. I get a compile error "Expecting an =".
Should I be changing the name of the VBA event code "cmdReportToPDF_Click()"
or something else?
It seems like I should should be using the following command in the
Immediate window but this doesn't work either.
ConvertReportToPDF("rptSupplierReportCardTest",,"SupplierReportCard.PDF")
where rptSupplierReportCardTest is the name of the ACCESS report in my
database and SupplierReportCard.PDF is the resulting PDF file. From the VBA
comments I am assuming the PDF file will be saved to the C:\My Documents
folder. Note I copied the the DLL's, two modules, and event procedure VBA to
my database. Help is greatly appreciated.
--
frank-a


SageOne said:
So if my report name is RptTestResults then I would do the following?

copy and paste two dll's to the folder of my database.

import "ModreprtToPdf" and " ModDocumentSource"

copy and paste this event procedure code into my form:

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 = 150, _
'Optional PasswordOpen As String = "", _
'Optional PasswordOwner As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0, _
'Optional PDFUnicodeFlags 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 - Resolution in DPI(Dots per Inch) to apply to embedded
Images
' PasswordOpen - Users require to Open PDF
' PasswordOwner - Users require to modify PDF
' PasswordRestrictions - Restrictions for viewing/editing/printing PDF - See
modReportToPDF for comments
' 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

' PDFUnicodeFlags controls how each metafile text record is interpreted in
terms
' of Unicode and BiDi language. See modDocumentor for details.
'
' 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.
blRet = ConvertReportToPDF(Me.lstRptName, vbNullString, _
Me.lstRptName.Value & ".pdf", False, True, 150, "", "", 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 change....'Public Function ConvertReportToPDF( _ to 'Public
Function RptTestResults( _



All help is greatly apreciated. Thank you very much.






Stephen Lebans said:
You must import all of the class and code modules from my sample MDB into
your own MDB.

If you look at the code behind the sample form you will see their is a
RptName parameter within the function call.

' 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 = 150, _
'Optional PasswordOpen As String = "", _
'Optional PasswordOwner As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0, _
'Optional PDFUnicodeFlags 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 - Resolution in DPI(Dots per Inch) to apply to embedded
Images
' PasswordOpen - Users require to Open PDF
' PasswordOwner - Users require to modify PDF
' PasswordRestrictions - Restrictions for viewing/editing/printing PDF - See
modReportToPDF for comments
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF.




--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


SageOne said:
I copied the sample database and (2) Dll files to my folder. The sample
database works just fine and converts the reports to pdf. Here is my new
dilemma:

I looked at the [event procedure] on the command button that stephen has
set
to convert a report to a pdf. Where in the event procedure code do I put
my
report name that I want to convert to a pdf file? Also, should I copy over
the modules and change any info? Any insight would be greatly appreciated.




:


Can I install Reports to Pdf if I am on a company server and do not have
permission to access Windows folders?

Put the DLLs in the same folder as your FE MDB/MDE on the client work
station. This does not require administrator rights for install.
This also means that you can update the DLLs should Stephen introduce
some new functionality and you do not have to depend on the IT
department to get their thumbs unstuck from their behinds.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
FSHOTT said:
I would like to use Stephan's Report to PDF in an Access application I have
for e-mailing ReportCard reports to my suppliers. I have studied the
questions and responses above but I am still confused on how to modify and
use Stephan"s VBA event procedure to execute the code correctly. In the
last
response there is an instruxction to cahnge the Public Function
ConvertReportToPDF() to Public Function RptTestResults()?

No, that would be completely wrong.
Farther up in the
response it indicated that the name of the report to be converted to PDF
is
RptTestResults. Is this really what should be done? It clearly doesn't
work
for me. I get a compile error "Expecting an =".
Should I be changing the name of the VBA event code
"cmdReportToPDF_Click()"
or something else?
It seems like I should should be using the following command in the
Immediate window but this doesn't work either.
ConvertReportToPDF("rptSupplierReportCardTest",,"SupplierReportCard.PDF")

The error you report -- "Expected: =" -- occurs because of the way you used
parentheses in your call to the function, and for no other reason. You can
either use this form:

ConvertReportToPDF "rptSupplierReportCardTest",,"SupplierReportCard.PDF"

or this form:

Call
ConvertReportToPDF("rptSupplierReportCardTest",,"SupplierReportCard.PDF")
 
Back
Top