Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB 6.0 to create Acrobat files. 4

Status
Not open for further replies.

DGA15

Programmer
Aug 19, 2000
40
0
0
US
I'm currently write specailized programs that create complicated VB reports. Users run the VB progam which prints their reports via Crystal Reports. I'm not satisfied with the variations in output that users achieve on different printers and different operating systems.
Is there someone on this form who does something similar, but produces .PDF files from Visual Basic.
Your experience would be of great help to me.
 
I do not know if this is useful to you but we do similar stuff here and basicallly the crystal reports or whatever the output is , we output them to a postscript/pdf file using a Postscript Driver(Acrobat Distiller)
Both PS and PDF files are device independent
let me know if you are interested
anu
 
Hi, anuc2000
Yes I am interested!!!
I create manuals for our company
And I used Adobe and distiller alot. I need to automate the process. I managed to create a Visual Basic App to get AutoCAD to open a drawing, print it out to distiller, and close the drawing when done. But Now I would like Adobe Acrobat to save that new file into a particular folder. Not the Default.

Any Ideas??? DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
I would be greatly interested in learning how to display dynamically created PDF reports over the Internet. I have both Distiller and AdobePDFMakerx on my machine but cannot figure which one to use or how. Thanks!
 
Very interested in seeing some samples of your code. Are you using Crystal reports 8.0?
Thanks
DGA15
 
Doug..
Can you please post the VB code snippet that does the conversion????

Very desperate..
Thank you...
RR

 
Just out of interest, Crystal reports Version 8.5 has an export opttion to export to PDF format.

Hope this is of use.

Chris Dukes
 
cdukes...

Have you tried accessing the PDF PrintFileType with the CrystalReport object in VB? As yet, I've been unable to.

CM
 
Subject Site Address
pdf converters pdf conversions pdf docs converted to online html pdf conversion pdf conversion to htlm pdf2html@adobe.com convert by email to html
pdf conversion by email pdf2txt@adobe.com conversts to .txt by email
pdf conversion by email
 
DougP and others,

I am not at all experienced with anything you all seem to be doing, but...I can give some possibilities for you to try. Distiller has a 'Watched Folder' option that would probably assist you. Basically you identify a folder for Distiller to monitor. When a postscript file arrives in the 'In' folder it gets processed and the pdf is placed in the 'Out' folder. The only drawback is that distiller must be running for it to monitor the folder(s). I'm sure you could code this though. Benefits are that each folder may be setup to use specific job options.

That's just one of many ideas...but it seems to be the best.

 
I have done something similar using a number of applications that print to the Distiller printer. My routines monitor the Distiller output directory, wait for the output PDF file to appear, and then move it to my chosen destination.

The script is written in Perl, but it's not very clever and it shouldn't take long to port to VB.

Let me know if you are interested

Nick
nick.hall@altasystems.co.uk
 
There was an above question about converting AutoCAD files into PDF through code. Here is the code that I use in my VBA programs to do it.

***
PlotPlanPath = <desired output path and filename>

Open (&quot;c:\windows\system\pdfwritr.ini&quot;) For Append As #1
Print #1, &quot;PDFFileName = '&quot; & PlotPlanPath & &quot;'&quot;
Close #1

On Error Resume Next 'because AutoCAD sometimes fails on the below lines

With ThisDrawing.ActiveLayout
.ConfigName = &quot;Acrobat PDFWriter.pc3&quot;
.CanonicalMediaName = &quot;Letter&quot;
.CenterPlot = True
.PlotType = acExtents
.PlotRotation = ac0degrees
.StandardScale = acScaleToFit
.StyleSheet = &quot;PDF Style.ctb&quot;
End With

ThisDrawing.Plot.PlotToDevice

DoEvents 'PDFWriter will trip over itself if I don't make it wait till it's done before continuing.
 
I need to print Crystal Reports inot .pdf files on the background using VB6 application. Can someone please post a sample of code showing how to do it.

Thank you.
 
Does anyone know if its possible to protect a .pdf file with a password so that it becomes impossible for a reciepient to alter it without the sender knowledge. I need to do this in VB6, we create the reports with crystal 8.5 then export them and email them in pdf format.
if the answer is yes, What do I need to do this. And how to do it.
thanks
 
If you use Distiller to create PDF's, yes.

The current password is stored in the Registry, can't remember where, and it gets used when Distiller creates a PDF.

If you need more detail let me know.

Nick
nick.hall@altasystems.co.uk
 
Since the version 3 of acrobat is what I still use I have use SendKeys becuase version 3 does not have a COM object model :-(

I don't use the SendKeys with distiller, but with Acrobat Exchange. I believe in later versions Acrobat Exchange has ben dropped. All of its abilities are in the Full Version Acrobat Reader now. I don't know if the latest version of the Reader has a COM model or not. None the less below is a snippet of code. Hope it helps...

Most of this code stuff is specific to the dbase I'm maintaing so focus on the SendKeys and you should be fine.

Public Sub Bookmarks()
' 0) use the view.mde to filter out all but the mdesc records.
' 1) open ACROBAT EXCHANGE if not Already open by openning a012 STANDARD PENETRATION TESTS
' PDF file.
' 2) Send commands to acrobat exchange for it to
' build index based on Mdesc section + &quot; &quot;+ desc
' 3) issue save command and exit ACROBAT EXCHANGE
Dim RStemp As Recordset
Dim DBview As Database
Dim toAcrobat, cLastSec, cThisSec As String
Dim myCount, recCount As Long
Dim chkAcrobat As Integer

' On Error GoTo errTrap
Set DBview = CurrentDb
Set RStemp = DBview.OpenRecordset(&quot;SELECT section, title FROM usc_spec ORDER BY section&quot;)
RStemp.Requery

Debug.Print DBview.Name, RStemp.RecordCount, RStemp!Section,

RStemp.MoveFirst
If vbOK = MsgBox(&quot;Open with ACROBAT EXCHANGE the *.PDF file you&quot; + Chr(13) + &quot;want to build an index for.&quot; + Chr(13) + Chr(13) + &quot;Select OK when finished openning ACROBAT EXCHANGE and *.PDF file&quot;, vbExclamation + vbOKCancel, &quot;USE THE START BUTTON TO:&quot;) Then
GoTo Begin
Else
MsgBox &quot;Operation Canceled&quot;
GoTo allDone
End If
Begin:
'make ACROBAT EXCHANGE current Application
AppActivate &quot;Adobe Acrobat&quot; 'error is trapped if not open
recCount = RStemp.RecordCount - RStemp.AbsolutePosition 'count of records
cLastSec = &quot;&quot;
cThisSec = &quot;&quot;
For myCount = 1 To recCount 'from current pos to end of set
cThisSec = Left(Trim(RStemp!Section), 2)
If cLastSec <> cThisSec Then
toAcrobat = newSpecDivision(cThisSec)
'find first division in heading
Debug.Print toAcrobat
SendKeys &quot;^{f}&quot; + toAcrobat + &quot;%{f}&quot;, True 'search for division heading
SendKeys &quot;^{b}&quot;, True 'create bookmark
End If
'Acrobat Exchange text search string
'these are dumb commands the program has no
'way of knowing if they were successfull.
'If an error occurs you will have to adjust the
'data and rebuild the Acorbat
toAcrobat = Trim(RStemp!Section) + &quot; &quot; + Trim(UCase(RStemp!title))
'the - char gives trouble to Acrobat's Find
chkAcrobat = InStr(1, toAcrobat, &quot; - &quot;)
If chkAcrobat > 0 Then
toAcrobat = Left(toAcrobat, chkAcrobat - 1)
End If
'the ( char gives trouble when sending
chkAcrobat = InStr(1, toAcrobat, &quot;(&quot;)
If chkAcrobat > 0 Then
toAcrobat = Left(toAcrobat, chkAcrobat - 1)
End If
'the ) char gives trouble when sending
chkAcrobat = InStr(1, toAcrobat, &quot;)&quot;)
If chkAcrobat > 0 Then
toAcrobat = Left(toAcrobat, chkAcrobat - 1)
End If
toAcrobat = Trim(toAcrobat)
Debug.Print toAcrobat
SendKeys &quot;^{f}&quot; + toAcrobat + &quot;%{f}&quot;, True 'search for spec and title
SendKeys &quot;^{b}&quot;, True 'create bookmark
cLastSec = cThisSec 'update division check
RStemp.MoveNext
Next myCount
RStemp.Close
'AppActivate &quot;Make View Database&quot;
GoTo allDone:

errTrap:
Select Case Err.Number
Case 91
MsgBox &quot;File not open &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description, vbOKOnly + vbCritical, &quot;You Must Open the View First&quot;
GoTo allDone
Case 5
MsgBox &quot;Application not open &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description + Chr(13) + toAcrobat, vbOKOnly + vbCritical, &quot;You must have ACROBAT EXCHANGE running!&quot;
GoTo allDone
Case Else 'all other errors
MsgBox &quot;Unknown Error &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description, vbOKOnly + vbCritical, &quot;Error mnuBuildAdobe&quot;
GoTo allDone
End Select

allDone: 'exit sub
End Sub
-Pete[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top