Print Page | Close Window

PDF processing too slow

Printed From: www.exp-systems.com
Category: PDF reDirect
Forum Name: Programming
Forum Discription: VBA and Batch Tools to control PDF reDirect Pro
URL: http://www.exp-systems.com/Forum_exp/forum_posts.asp?TID=523
Printed Date: 21 Jan 22 at 1:47AM


Topic: PDF processing too slow
Posted By: kjs99
Subject: PDF processing too slow
Date 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



Replies:
Posted By: Michel_K17
Date 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


Posted By: Michel_K17
Date 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


Posted By: vinill
Date 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.



Print Page | Close Window