Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Programming
 EXP Systems Forum : PDF reDirect : Programming
Topic: PDF processing too slow Post Reply Post New Topic
Author Message
kjs99
Newbie
Newbie


Joined: 21 Aug 09
Location: United States
Posts: 1
Quote kjs99 Replybullet Topic: PDF processing too slow
    Posted: 21 Aug 09 at 11:36AM
So this is my issue:  I have a VBA program inside of Autocad, that finds all of the titleblock in the drawing and prints them to PDF reDirect.  However,  it takes redirect a fair amount of time to process the first request, the VBA program finishes and only one drawing  gets printed.  Is there some way to queue the prints so that redirect has time to process them all?  Or do I need to slow down the VBA routine in Autocad?
 
Any ideas appreciated.
 
Kevin
IP IP Logged
Michel_K17
Moderator Group
Moderator Group
Avatar
Forum Administrator

Joined: 25 Jan 03
Posts: 1673
Quote Michel_K17 Replybullet Posted: 21 Aug 09 at 7:06PM
Hi,

   Are you using my ActiveX component with you VBA code? If so, I think I have sample code that shows you how to wait for the print job to complete before printing the next one.

   I'll post back later tonight with the code, or at least a better description.

   Cheers!

Michel
Michel Korwin-Szymanowski
EXP Systems LLC
IP IP Logged
Michel_K17
Moderator Group
Moderator Group
Avatar
Forum Administrator

Joined: 25 Jan 03
Posts: 1673
Quote Michel_K17 Replybullet Posted: 22 Aug 09 at 10:10AM
Hi Kevin,

   Here is the rest of the story. Smile

   If you have not already done so, download and install my PDF reDirect Remote Control ActiveX Component from [here].

   Look at the code in the MS Word example. Look at the more powerful (extended) conversion function called Convert2PdfEx

    After starting the conversion to the PDF by printing the document, it calls the function PdfCreated to wait for the job to complete.

        '-------------------------------
        ' Wait until the PDF was created
        '-------------------------------
        ' Wait until the original file (if there) is deleted by the Batch Printer, up to 1 minute maximum
        ' Note: if the PDF is busy (because it is opened in a PDF Reader), it will
        '       attempt to close the file automatically.
        If Not PdfCreated(MyOutputPathAndFile, OriginalDateTime) Then GoTo Error_Occured
 
   The function PdfCreated is pretty short:

'---------------------------------------------------------------------------------------
' Procedure : PdfCreated
' Author    : Michel_K17
' Purpose   : Wait until a PDF file has been created by the Batch Printer
' History   : v1 (7/10/04)
'---------------------------------------------------------------------------------------
Public Function PdfCreated(ByRef PathToFile As String, Optional ByRef OriginalDateTime As Date, Optional ByRef MaxSeconds2Wait As Single = 60) As Boolean
   
    Dim MaxTime2Wait As Single
   
    On Error Resume Next
   
    ' Wait for the original PDF file to be deleted
    ' Do not wait more than one minute
    MaxTime2Wait = Timer() + MaxSeconds2Wait
    Do While MaxTime2Wait >= Timer And Len(Dir$(PathToFile)) > 0 And FileDateTime(PathToFile) = OriginalDateTime ' And
        ' Share the CPU with other programs
        Sleep (100)
        DoEvents
    Loop

    'Now wait until the new PDF file is fully created
    ' Set Timer to 60 seconds max (use something higher for large documents)
    MaxTime2Wait = Timer() + MaxSeconds2Wait
    Do While MaxTime2Wait >= Timer And Not CheckFileAvailable(PathToFile)
        ' Share the CPU with other programs
        Sleep (100)
        DoEvents
    Loop
   
    ' Check if successful (ie Timer did not time out)
    If MaxTime2Wait > Timer Then
        PdfCreated = True
    Else
        oPDF.LastErrorDescription = "PDF file was not created after" & Str$(MaxSeconds2Wait) & " seconds of waiting."
    End If
   
End Function

  There is one caveat that someone else told me about is that for very large/complex files, waiting 1 minute may be insufficient. You may want to consider giving your computer more time to perfrom the conversion before giving up.

   Also, note that the function CheckFileAvailable called by PdfCreated which actually checks the output file to ensure that it is 100% written and released.

    Cheers!

Michel
Michel Korwin-Szymanowski
EXP Systems LLC
IP IP Logged
vinill
Newbie
Newbie


Joined: 15 Jan 12
Location: United States
Posts: 3
Quote vinill Replybullet Posted: 16 Jan 12 at 11:21PM
I too have the same issue and this causes too much time. I need to make PDF conversion for printing, fast. I have gone through the suggestions by Michel K17 and I think it will make the situation better. I will definitely download and install the PDF reDirect Remote Control ActiveX Component from by you today itself and will check whether it made PDF conversion faster or not. If queuing facility is available, that will make the process much faster.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum