Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Beginners


Topic: Help - Creating content in VB is very slow
Conf: (P-PDF) Beginners, Msg: 81268
From: netuser
Date: 2/12/2003 07:55 AM

I want to create a report - rows and columns with some formatting. I use the following code. However, it is very slow. It takes about 30 minutes to create 492 fields and almost 3 minutes to print. Obviously, I am doing something wrong. The machine is a P4.

Can someone help me? Thanks.


2/11/2003 10:16:32 AM App started
2/11/2003 10:16:34 AM Looping started
2/11/2003 10:45:09 AM Looping ended
2/11/2003 10:45:09 AM Printing started
2/11/2003 10:48:20 AM Printing ended - 492 items printed


Private Sub CmdTest_Click()

Dim I As Integer, j As Integer, total As Long
Dim intLeft As Integer, intTop As Integer
'Set the mouse icon to display an hourglass
'Screen.MousePointer = 11

Debug.Print ""
Debug.Print Now() & " " & "Application started"

' Open the sample PDF file
Set avDoc = CreateObject("AcroExch.AVDoc")
bOK = avDoc.Open(App.Path & "\blank.pdf", "RealTimePnL")

'If everything was OK opening the PDF, we now instantiate the Forms
'Automation object.
If (bOK) Then
Set formApp = CreateObject("AFormAut.App")
Set acroForm = formApp.Fields
Else
Set avDoc = Nothing
MsgBox "Failed to open PDF Document. Aborting..."
End
End If

Const LEFT_MARGIN = 30
Const TABLE_TOP = 50
Const TABLE_WIDTH = 58
Const TABLE_HIGHT = 50
Const BLANK_SPACE = 4

Debug.Print Now() & " " & "Looping started"

total = 0
For I = 0 To 11
For j = 0 To 20
intLeft = LEFT_MARGIN + I * (TABLE_WIDTH + BLANK_SPACE)
intTop = 612 - (TABLE_TOP + j * TABLE_HIGHT + BLANK_SPACE)
BuildNumberBox intLeft, intTop, intLeft + TABLE_WIDTH, intTop - TABLE_HIGHT
total = total + 1
Next j
Next I

Debug.Print Now() & " " & "Looping ended"

Debug.Print Now() & " " & "Printing started"

Set pdDoc = avDoc.GetPDDoc
bOK = pdDoc.Save(1, App.Path & "\test.pdf")
If bOK = False Then
MsgBox "Unable to Save the PDF file"
End If

Debug.Print Now() & " " & "Printing ended - " & total & " items printed"

' Close the AVDoc
avDoc.Close (False)

End Sub


Sub BuildNumberBox(intLeft, intTop, intRight, intButton)
Set field = acroForm.Add("Number", "text", 0, intLeft, intTop, intRight, intButton)

field.Value = "This will give some idea" & vbCrLf & "$8,000,000.56" & vbCrLf & "WAIT_TO_SEE"

field.IsMultiline = True
' field.TextSize = "8"
' field.TextFont = "Tahoma"
' field.IsReadOnly = True
' field.Alignment = "right"
' field.IsHidden = False
' field.SetBorderColor "RGB", 0.7, 0.5, 0.3, 0
' field.SetForegroundColor "RGB", 0, 0, 0, 0
End Sub


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.